<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}</span><span>
</span><span id="line-5"></span><span>
</span><span id="line-6"></span><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE MultiWayIf #-}</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Core.SimpleOpt</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-10"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Simple expression optimiser</span></span><span>
</span><span id="line-11"></span><span>        </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptPgm"><span class="hs-identifier">simpleOptPgm</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptExpr"><span class="hs-identifier">simpleOptExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptExprWith"><span class="hs-identifier">simpleOptExprWith</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Join points</span></span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#joinPointBinding_maybe"><span class="hs-identifier">joinPointBinding_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#joinPointBindings_maybe"><span class="hs-identifier">joinPointBindings_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Predicates on expressions</span></span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsConApp_maybe"><span class="hs-identifier">exprIsConApp_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier">exprIsLiteral_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier">exprIsLambda_maybe</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><span class="hs-comment">-- ** Coercions and casts</span></span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoArg"><span class="hs-identifier">pushCoArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoValArg"><span class="hs-identifier">pushCoValArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoTyArg"><span class="hs-identifier">pushCoTyArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#collectBindersPushingCo"><span class="hs-identifier">collectBindersPushingCo</span></a></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Opt.Arity.html"><span class="hs-identifier">GHC.Core.Opt.Arity</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Opt.Arity.html#etaExpandToJoinPoint"><span class="hs-identifier">etaExpandToJoinPoint</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Subst.html"><span class="hs-identifier">GHC.Core.Subst</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Utils.html"><span class="hs-identifier">GHC.Core.Utils</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FVs.html"><span class="hs-identifier">GHC.Core.FVs</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Core.Unfold.html"><span class="hs-identifier">GHC.Core.Unfold</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Unfold.html#mkUnfolding"><span class="hs-identifier">mkUnfolding</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Make.html"><span class="hs-identifier">GHC.Core.Make</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier">FloatBind</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Ppr.html"><span class="hs-identifier">GHC.Core.Ppr</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Ppr.html#pprCoreBindings"><span class="hs-identifier">pprCoreBindings</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Ppr.html#pprRules"><span class="hs-identifier">pprRules</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Opt.OccurAnal.html"><span class="hs-identifier">GHC.Core.Opt.OccurAnal</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Opt.OccurAnal.html#occurAnalyseExpr"><span class="hs-identifier">occurAnalyseExpr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Opt.OccurAnal.html#occurAnalysePgm"><span class="hs-identifier">occurAnalysePgm</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Literal.html"><span class="hs-identifier">GHC.Types.Literal</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html"><span class="hs-identifier">GHC.Types.Id.Info</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html#unfoldingInfo"><span class="hs-identifier">unfoldingInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html#setUnfoldingInfo"><span class="hs-identifier">setUnfoldingInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html#setRuleInfo"><span class="hs-identifier">setRuleInfo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Id.Info.html#IdInfo"><span class="hs-identifier">IdInfo</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#isNonCoVarId"><span class="hs-identifier">isNonCoVarId</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html"><span class="hs-identifier">GHC.Types.Demand</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#etaConvertStrictSig"><span class="hs-identifier">etaConvertStrictSig</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html"><span class="hs-identifier">GHC.Core.Coercion.Opt</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier">optCoercion</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTy"><span class="hs-identifier">substTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTvSubst"><span class="hs-identifier">extendTvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendCvSubst"><span class="hs-identifier">extendCvSubst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#extendTvSubstList"><span class="hs-identifier">extendTvSubstList</span></a></span><span>
</span><span id="line-47"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#isInScope"><span class="hs-identifier">isInScope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substTyVarBndr"><span class="hs-identifier">substTyVarBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#cloneTyVarBndr"><span class="hs-identifier">cloneTyVarBndr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Coercion.html"><span class="hs-identifier">GHC.Core.Coercion</span></a></span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substCo"><span class="hs-identifier">substCo</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Subst.html#substCoVarBndr"><span class="hs-identifier">substCoVarBndr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#tyConArity"><span class="hs-identifier">tyConArity</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier">Module</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Encoding.html"><span class="hs-identifier">GHC.Utils.Encoding</span></a></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html"><span class="hs-identifier">GHC.Data.Pair</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#orElse"><span class="hs-identifier">orElse</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.html#"><span class="hs-identifier">Data.ByteString</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">BS</span></span><span>
</span><span id="line-64"></span><span>
</span><span id="line-65"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        The Simple Optimiser
*                                                                      *
************************************************************************

Note [The simple optimiser]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
The simple optimiser is a lightweight, pure (non-monadic) function
that rapidly does a lot of simple optimisations, including

  - inlining things that occur just once,
      or whose RHS turns out to be trivial
  - beta reduction
  - case of known constructor
  - dead code elimination

It does NOT do any call-site inlining; it only inlines a function if
it can do so unconditionally, dropping the binding.  It thereby
guarantees to leave no un-reduced beta-redexes.

It is careful to follow the guidance of &quot;Secrets of the GHC inliner&quot;,
and in particular the pre-inline-unconditionally and
post-inline-unconditionally story, to do effective beta reduction on
functions called precisely once, without repeatedly optimising the same
expression.  In fact, the simple optimiser is a good example of this
little dance in action; the full Simplifier is a lot more complicated.

-}</span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptExpr"><span class="hs-identifier hs-type">simpleOptExpr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-97"></span><span class="hs-comment">-- See Note [The simple optimiser]</span><span>
</span><span id="line-98"></span><span class="hs-comment">-- Do simple optimisation on an expression</span><span>
</span><span id="line-99"></span><span class="hs-comment">-- The optimisation is very straightforward: just</span><span>
</span><span id="line-100"></span><span class="hs-comment">-- inline non-recursive bindings that are used only once,</span><span>
</span><span id="line-101"></span><span class="hs-comment">-- or where the RHS is trivial</span><span>
</span><span id="line-102"></span><span class="hs-comment">--</span><span>
</span><span id="line-103"></span><span class="hs-comment">-- We also inline bindings that bind a Eq# box: see</span><span>
</span><span id="line-104"></span><span class="hs-comment">-- See Note [Getting the map/coerce RULE to work].</span><span>
</span><span id="line-105"></span><span class="hs-comment">--</span><span>
</span><span id="line-106"></span><span class="hs-comment">-- Also we convert functions to join points where possible (as</span><span>
</span><span id="line-107"></span><span class="hs-comment">-- the occurrence analyser does most of the work anyway).</span><span>
</span><span id="line-108"></span><span class="hs-comment">--</span><span>
</span><span id="line-109"></span><span class="hs-comment">-- The result is NOT guaranteed occurrence-analysed, because</span><span>
</span><span id="line-110"></span><span class="hs-comment">-- in  (let x = y in ....) we substitute for x; so y's occ-info</span><span>
</span><span id="line-111"></span><span class="hs-comment">-- may change radically</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span id="simpleOptExpr"><span class="annot"><span class="annottext">simpleOptExpr :: HasDebugCallStack =&gt; DynFlags -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simpleOptExpr"><span class="hs-identifier hs-var hs-var">simpleOptExpr</span></a></span></span><span> </span><span id="local-6989586621680865117"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865117"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680865116"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865116"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-114"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- pprTrace &quot;simpleOptExpr&quot; (ppr init_subst $$ ppr expr)</span><span>
</span><span id="line-115"></span><span>    </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; DynFlags -&gt; Subst -&gt; Expr Var -&gt; Expr Var
DynFlags -&gt; Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simpleOptExprWith"><span class="hs-identifier hs-var">simpleOptExprWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865117"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865115"><span class="hs-identifier hs-var">init_subst</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865116"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-116"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-117"></span><span>    </span><span id="local-6989586621680865115"><span class="annot"><span class="annottext">init_subst :: Subst
</span><a href="#local-6989586621680865115"><span class="hs-identifier hs-var hs-var">init_subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkEmptySubst"><span class="hs-identifier hs-var">mkEmptySubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">VarSet -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#mkInScopeSet"><span class="hs-identifier hs-var">mkInScopeSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; VarSet
</span><a href="GHC.Core.FVs.html#exprFreeVars"><span class="hs-identifier hs-var">exprFreeVars</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865116"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-118"></span><span>        </span><span class="hs-comment">-- It's potentially important to make a proper in-scope set</span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-comment">-- Consider  let x = ..y.. in \y. ...x...</span><span>
</span><span id="line-120"></span><span>        </span><span class="hs-comment">-- Then we should remember to clone y before substituting</span><span>
</span><span id="line-121"></span><span>        </span><span class="hs-comment">-- for x.  It's very unlikely to occur, because we probably</span><span>
</span><span id="line-122"></span><span>        </span><span class="hs-comment">-- won't *be* substituting for x if it occurs inside a</span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-comment">-- lambda.</span><span>
</span><span id="line-124"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-125"></span><span>        </span><span class="hs-comment">-- It's a bit painful to call exprFreeVars, because it makes</span><span>
</span><span id="line-126"></span><span>        </span><span class="hs-comment">-- three passes instead of two (occ-anal, and go)</span><span>
</span><span id="line-127"></span><span>
</span><span id="line-128"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptExprWith"><span class="hs-identifier hs-type">simpleOptExprWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.Subst.html#Subst"><span class="hs-identifier hs-type">Subst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span>
</span><span id="line-129"></span><span class="hs-comment">-- See Note [The simple optimiser]</span><span>
</span><span id="line-130"></span><span id="simpleOptExprWith"><span class="annot"><span class="annottext">simpleOptExprWith :: HasDebugCallStack =&gt; DynFlags -&gt; Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simpleOptExprWith"><span class="hs-identifier hs-var hs-var">simpleOptExprWith</span></a></span></span><span> </span><span id="local-6989586621680865106"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865106"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680865105"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865105"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680865104"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865104"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-131"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865102"><span class="hs-identifier hs-var">init_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Opt.OccurAnal.html#occurAnalyseExpr"><span class="hs-identifier hs-var">occurAnalyseExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865104"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-132"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-133"></span><span>    </span><span id="local-6989586621680865102"><span class="annot"><span class="annottext">init_env :: SimpleOptEnv
</span><a href="#local-6989586621680865102"><span class="hs-identifier hs-var hs-var">init_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SOE :: DynFlags -&gt; IdEnv SimpleClo -&gt; Subst -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_dflags :: DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var">soe_dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865106"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-134"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_inl :: IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span>
</span><span id="line-135"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865105"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-138"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleOptPgm"><span class="hs-identifier hs-type">simpleOptPgm</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span>
</span><span id="line-139"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreProgram"><span class="hs-identifier hs-type">CoreProgram</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreRule"><span class="hs-identifier hs-type">CoreRule</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-140"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreProgram"><span class="hs-identifier hs-type">CoreProgram</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreRule"><span class="hs-identifier hs-type">CoreRule</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span class="hs-comment">-- See Note [The simple optimiser]</span><span>
</span><span id="line-142"></span><span id="simpleOptPgm"><span class="annot"><span class="annottext">simpleOptPgm :: DynFlags
-&gt; Module
-&gt; CoreProgram
-&gt; [CoreRule]
-&gt; IO (CoreProgram, [CoreRule])
</span><a href="GHC.Core.SimpleOpt.html#simpleOptPgm"><span class="hs-identifier hs-var hs-var">simpleOptPgm</span></a></span></span><span> </span><span id="local-6989586621680865096"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865096"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680865095"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680865095"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680865094"><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865094"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621680865093"><span class="annot"><span class="annottext">[CoreRule]
</span><a href="#local-6989586621680865093"><span class="hs-identifier hs-var">rules</span></a></span></span><span>
</span><span id="line-143"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; DumpFlag -&gt; String -&gt; DumpFormat -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#dumpIfSet_dyn"><span class="hs-identifier hs-var">dumpIfSet_dyn</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865096"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">DumpFlag
</span><a href="GHC.Driver.Flags.html#Opt_D_dump_occur_anal"><span class="hs-identifier hs-var">Opt_D_dump_occur_anal</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Occurrence analysis&quot;</span></span><span>
</span><span id="line-144"></span><span>            </span><span class="annot"><span class="annottext">DumpFormat
</span><a href="GHC.Utils.Error.html#FormatCore"><span class="hs-identifier hs-var">FormatCore</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreProgram -&gt; SDoc
forall b. OutputableBndr b =&gt; [Bind b] -&gt; SDoc
</span><a href="GHC.Core.Ppr.html#pprCoreBindings"><span class="hs-identifier hs-var">pprCoreBindings</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865089"><span class="hs-identifier hs-var">occ_anald_binds</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreRule] -&gt; SDoc
</span><a href="GHC.Core.Ppr.html#pprRules"><span class="hs-identifier hs-var">pprRules</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreRule]
</span><a href="#local-6989586621680865093"><span class="hs-identifier hs-var">rules</span></a></span><span> </span><span class="hs-special">)</span><span class="hs-special">;</span><span>
</span><span id="line-145"></span><span>
</span><span id="line-146"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(CoreProgram, [CoreRule]) -&gt; IO (CoreProgram, [CoreRule])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoreProgram -&gt; CoreProgram
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865086"><span class="hs-identifier hs-var">binds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[CoreRule]
</span><a href="#local-6989586621680865085"><span class="hs-identifier hs-var">rules'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-147"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-148"></span><span>    </span><span id="local-6989586621680865089"><span class="annot"><span class="annottext">occ_anald_binds :: CoreProgram
</span><a href="#local-6989586621680865089"><span class="hs-identifier hs-var hs-var">occ_anald_binds</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Module
-&gt; (Var -&gt; Bool)
-&gt; (Activation -&gt; Bool)
-&gt; [CoreRule]
-&gt; CoreProgram
-&gt; CoreProgram
</span><a href="GHC.Core.Opt.OccurAnal.html#occurAnalysePgm"><span class="hs-identifier hs-var">occurAnalysePgm</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621680865095"><span class="hs-identifier hs-var">this_mod</span></a></span><span>
</span><span id="line-149"></span><span>                          </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Var
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">{- All unfoldings active -}</span><span>
</span><span id="line-150"></span><span>                          </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="annot"><span class="annottext">Activation
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">{- No rules active -}</span><span>
</span><span id="line-151"></span><span>                          </span><span class="annot"><span class="annottext">[CoreRule]
</span><a href="#local-6989586621680865093"><span class="hs-identifier hs-var">rules</span></a></span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865094"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-152"></span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680865082"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865082"><span class="hs-identifier hs-var">final_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680865086"><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865086"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((SimpleOptEnv, CoreProgram)
 -&gt; InBind -&gt; (SimpleOptEnv, CoreProgram))
-&gt; (SimpleOptEnv, CoreProgram)
-&gt; CoreProgram
-&gt; (SimpleOptEnv, CoreProgram)
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">(SimpleOptEnv, CoreProgram)
-&gt; InBind -&gt; (SimpleOptEnv, CoreProgram)
</span><a href="#local-6989586621680865080"><span class="hs-identifier hs-var">do_one</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#emptyEnv"><span class="hs-identifier hs-var">emptyEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865096"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865089"><span class="hs-identifier hs-var">occ_anald_binds</span></a></span><span>
</span><span id="line-154"></span><span>    </span><span id="local-6989586621680865078"><span class="annot"><span class="annottext">final_subst :: Subst
</span><a href="#local-6989586621680865078"><span class="hs-identifier hs-var hs-var">final_subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865082"><span class="hs-identifier hs-var">final_env</span></a></span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>    </span><span id="local-6989586621680865085"><span class="annot"><span class="annottext">rules' :: [CoreRule]
</span><a href="#local-6989586621680865085"><span class="hs-identifier hs-var hs-var">rules'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; [CoreRule] -&gt; [CoreRule]
</span><a href="GHC.Core.Subst.html#substRulesForImportedIds"><span class="hs-identifier hs-var">substRulesForImportedIds</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865078"><span class="hs-identifier hs-var">final_subst</span></a></span><span> </span><span class="annot"><span class="annottext">[CoreRule]
</span><a href="#local-6989586621680865093"><span class="hs-identifier hs-var">rules</span></a></span><span>
</span><span id="line-157"></span><span>             </span><span class="hs-comment">-- We never unconditionally inline into rules,</span><span>
</span><span id="line-158"></span><span>             </span><span class="hs-comment">-- hence paying just a substitution</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span>    </span><span id="local-6989586621680865080"><span class="annot"><span class="annottext">do_one :: (SimpleOptEnv, CoreProgram)
-&gt; InBind -&gt; (SimpleOptEnv, CoreProgram)
</span><a href="#local-6989586621680865080"><span class="hs-identifier hs-var hs-var">do_one</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680865076"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865076"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680865075"><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865075"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680865074"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680865074"><span class="hs-identifier hs-var">bind</span></a></span></span><span>
</span><span id="line-161"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; InBind -&gt; TopLevelFlag -&gt; (SimpleOptEnv, Maybe InBind)
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-var">simple_opt_bind</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865076"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680865074"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#TopLevel"><span class="hs-identifier hs-var">TopLevel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-162"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621680865071"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865071"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe InBind
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865071"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865075"><span class="hs-identifier hs-var">binds'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621680865070"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865070"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680865069"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680865069"><span class="hs-identifier hs-var">bind'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865070"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680865069"><span class="hs-identifier hs-var">bind'</span></a></span><span class="annot"><span class="annottext">InBind -&gt; CoreProgram -&gt; CoreProgram
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">CoreProgram
</span><a href="#local-6989586621680865075"><span class="hs-identifier hs-var">binds'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-164"></span><span>
</span><span id="line-165"></span><span class="hs-comment">-- In these functions the substitution maps InVar -&gt; OutExpr</span><span>
</span><span id="line-166"></span><span>
</span><span id="line-167"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-168"></span><span class="hs-keyword">type</span><span> </span><span id="SimpleClo"><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-var">SimpleClo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-keyword">data</span><span> </span><span id="SimpleOptEnv"><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-var">SimpleOptEnv</span></a></span></span><span>
</span><span id="line-171"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="SOE"><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-var">SOE</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="soe_dflags"><span class="annot"><span class="annottext">SimpleOptEnv -&gt; DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var hs-var">soe_dflags</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-172"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="soe_inl"><span class="annot"><span class="annottext">SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var hs-var">soe_inl</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#IdEnv"><span class="hs-identifier hs-type">IdEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-type">SimpleClo</span></a></span><span>
</span><span id="line-173"></span><span>             </span><span class="hs-comment">-- Deals with preInlineUnconditionally; things</span><span>
</span><span id="line-174"></span><span>             </span><span class="hs-comment">-- that occur exactly once and are inlined</span><span>
</span><span id="line-175"></span><span>             </span><span class="hs-comment">-- without having first been simplified</span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="soe_subst"><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.Subst.html#Subst"><span class="hs-identifier hs-type">Subst</span></a></span><span>
</span><span id="line-178"></span><span>             </span><span class="hs-comment">-- Deals with cloning; includes the InScopeSet</span><span>
</span><span id="line-179"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680865066"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>  </span><span id="local-6989586621680865057"><span class="annot"><span class="annottext">ppr :: SimpleOptEnv -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_inl :: SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680865055"><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680865055"><span class="hs-identifier hs-var">inl</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680865054"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865054"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;SOE {&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;soe_inl   =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680865055"><span class="hs-identifier hs-var">inl</span></a></span><span>
</span><span id="line-184"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;soe_subst =&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Subst -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865054"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-185"></span><span>                   </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;}&quot;</span></span><span>
</span><span id="line-186"></span><span>
</span><span id="line-187"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#emptyEnv"><span class="hs-identifier hs-type">emptyEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-188"></span><span id="emptyEnv"><span class="annot"><span class="annottext">emptyEnv :: DynFlags -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#emptyEnv"><span class="hs-identifier hs-var hs-var">emptyEnv</span></a></span></span><span> </span><span id="local-6989586621680865050"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865050"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>
</span><span id="line-189"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SOE :: DynFlags -&gt; IdEnv SimpleClo -&gt; Subst -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_dflags :: DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var">soe_dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680865050"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-190"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_inl :: IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span>
</span><span id="line-191"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="GHC.Core.Subst.html#emptySubst"><span class="hs-identifier hs-var">emptySubst</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#soeZapSubst"><span class="hs-identifier hs-type">soeZapSubst</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-194"></span><span id="soeZapSubst"><span class="annot"><span class="annottext">soeZapSubst :: SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeZapSubst"><span class="hs-identifier hs-var hs-var">soeZapSubst</span></a></span></span><span> </span><span id="local-6989586621680865047"><span class="annot"><span class="annottext">env :: SimpleOptEnv
</span><a href="#local-6989586621680865047"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680865046"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865046"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-195"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865047"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_inl :: IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Subst
</span><a href="GHC.Core.Subst.html#zapSubstEnv"><span class="hs-identifier hs-var">zapSubstEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865046"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#soeSetInScope"><span class="hs-identifier hs-type">soeSetInScope</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-198"></span><span class="hs-comment">-- Take in-scope set from env1, and the rest from env2</span><span>
</span><span id="line-199"></span><span id="soeSetInScope"><span class="annot"><span class="annottext">soeSetInScope :: SimpleOptEnv -&gt; SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeSetInScope"><span class="hs-identifier hs-var hs-var">soeSetInScope</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680865043"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865043"><span class="hs-identifier hs-var">subst1</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-200"></span><span>              </span><span id="local-6989586621680865042"><span class="annot"><span class="annottext">env2 :: SimpleOptEnv
</span><a href="#local-6989586621680865042"><span class="hs-identifier hs-var">env2</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680865041"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865041"><span class="hs-identifier hs-var">subst2</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-201"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865042"><span class="hs-identifier hs-var">env2</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#setInScope"><span class="hs-identifier hs-var">setInScope</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865041"><span class="hs-identifier hs-var">subst2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; InScopeSet
</span><a href="GHC.Core.Subst.html#substInScope"><span class="hs-identifier hs-var">substInScope</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865043"><span class="hs-identifier hs-var">subst1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-202"></span><span>
</span><span id="line-203"></span><span class="hs-comment">---------------</span><span>
</span><span id="line-204"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_opt_clo"><span class="hs-identifier hs-type">simple_opt_clo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-type">SimpleClo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span>
</span><span id="line-205"></span><span id="simple_opt_clo"><span class="annot"><span class="annottext">simple_opt_clo :: SimpleOptEnv -&gt; SimpleClo -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_clo"><span class="hs-identifier hs-var hs-var">simple_opt_clo</span></a></span></span><span> </span><span id="local-6989586621680865037"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865037"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680865036"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865036"><span class="hs-identifier hs-var">e_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680865035"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865035"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-206"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeSetInScope"><span class="hs-identifier hs-var">soeSetInScope</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865037"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865036"><span class="hs-identifier hs-var">e_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865035"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-type">simple_opt_expr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Stack.Types.html#HasCallStack"><span class="hs-identifier hs-type">HasCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span>
</span><span id="line-209"></span><span id="simple_opt_expr"><span class="annot"><span class="annottext">simple_opt_expr :: HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var hs-var">simple_opt_expr</span></a></span></span><span> </span><span id="local-6989586621680865033"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680865032"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865032"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-210"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865032"><span class="hs-identifier hs-var">expr</span></a></span><span>
</span><span id="line-211"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-212"></span><span>    </span><span id="local-6989586621680865030"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-213"></span><span>    </span><span id="local-6989586621680865029"><span class="annot"><span class="annottext">in_scope :: InScopeSet
</span><a href="#local-6989586621680865029"><span class="hs-identifier hs-var hs-var">in_scope</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; InScopeSet
</span><a href="GHC.Core.Subst.html#substInScope"><span class="hs-identifier hs-var">substInScope</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var">subst</span></a></span><span>
</span><span id="line-214"></span><span>    </span><span id="local-6989586621680865028"><span class="annot"><span class="annottext">in_scope_env :: (InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680865028"><span class="hs-identifier hs-var hs-var">in_scope_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680865029"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Core.SimpleOpt.html#simpleUnfoldingFun"><span class="hs-identifier hs-var">simpleUnfoldingFun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-comment">---------------</span><span>
</span><span id="line-217"></span><span>    </span><span id="local-6989586621680865031"><span class="annot"><span class="annottext">go :: Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680865013"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680865013"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680865012"><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680865012"><span class="hs-identifier hs-var">clo</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo -&gt; Var -&gt; Maybe SimpleClo
forall a. VarEnv a -&gt; Var -&gt; Maybe a
</span><a href="GHC.Types.Var.Env.html#lookupVarEnv"><span class="hs-identifier hs-var">lookupVarEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var hs-var">soe_inl</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680865013"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-219"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleClo -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_clo"><span class="hs-identifier hs-var">simple_opt_clo</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680865012"><span class="hs-identifier hs-var">clo</span></a></span><span>
</span><span id="line-220"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-221"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Var -&gt; Expr Var
Subst -&gt; Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#lookupIdSubst"><span class="hs-identifier hs-var">lookupIdSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680865013"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-222"></span><span>
</span><span id="line-223"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span id="local-6989586621680865008"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865008"><span class="hs-identifier hs-var">e1</span></a></span></span><span> </span><span id="local-6989586621680865007"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865007"><span class="hs-identifier hs-var">e2</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865008"><span class="hs-identifier hs-var">e1</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680865007"><span class="hs-identifier hs-var">e2</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-224"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621680865004"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680865004"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Expr Var
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span>     </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Type -&gt; Type
</span><a href="GHC.Core.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680865004"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span id="local-6989586621680865001"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680865001"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Expr Var
forall b. CoercionR -&gt; Expr b
</span><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-var">Coercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR
</span><a href="#local-6989586621680865000"><span class="hs-identifier hs-var">go_co</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680865001"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span id="local-6989586621680864998"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864998"><span class="hs-identifier hs-var">lit</span></a></span></span><span class="hs-special">)</span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Expr Var
forall b. Literal -&gt; Expr b
</span><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-var">Lit</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864998"><span class="hs-identifier hs-var">lit</span></a></span><span>
</span><span id="line-227"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680864996"><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864996"><span class="hs-identifier hs-var">tickish</span></a></span></span><span> </span><span id="local-6989586621680864995"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864995"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkTick"><span class="hs-identifier hs-var">mkTick</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Tickish Var -&gt; Tickish Var
</span><a href="GHC.Core.Subst.html#substTickish"><span class="hs-identifier hs-var">substTickish</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864996"><span class="hs-identifier hs-var">tickish</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864995"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864991"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864991"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864990"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864990"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var">mk_cast</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864991"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR
</span><a href="#local-6989586621680865000"><span class="hs-identifier hs-var">go_co</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864990"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Let"><span class="hs-identifier hs-type">Let</span></a></span><span> </span><span id="local-6989586621680864987"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864987"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621680864986"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864986"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; InBind -&gt; TopLevelFlag -&gt; (SimpleOptEnv, Maybe InBind)
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-var">simple_opt_bind</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864987"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-230"></span><span>                             </span><span class="hs-special">(</span><span id="local-6989586621680864984"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864984"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe InBind
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864984"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864986"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-231"></span><span>                             </span><span class="hs-special">(</span><span id="local-6989586621680864983"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864983"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864982"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864982"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Expr Var -&gt; Expr Var
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864982"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864983"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864986"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-232"></span><span>
</span><span id="line-233"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864981"><span class="annot"><span class="annottext">lam :: Expr Var
</span><a href="#local-6989586621680864981"><span class="hs-identifier hs-var">lam</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; [Var] -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864979"><span class="hs-identifier hs-var">go_lam</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864981"><span class="hs-identifier hs-var">lam</span></a></span><span>
</span><span id="line-234"></span><span>    </span><span class="annot"><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Case"><span class="hs-identifier hs-type">Case</span></a></span><span> </span><span id="local-6989586621680864977"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864977"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864976"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864976"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864975"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864975"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680864974"><span class="annot"><span class="annottext">[Alt Var]
</span><a href="#local-6989586621680864974"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span>       </span><span class="hs-comment">-- See Note [Getting the map/coerce RULE to work]</span><span>
</span><span id="line-236"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Id.html#isDeadBinder"><span class="hs-identifier hs-var">isDeadBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864976"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-237"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864972"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864972"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864971"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864971"><span class="hs-identifier hs-var">_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864970"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864970"><span class="hs-identifier hs-var">es</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
HasDebugCallStack =&gt;
(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsConApp_maybe"><span class="hs-identifier hs-var">exprIsConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680865028"><span class="hs-identifier hs-var">in_scope_env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864969"><span class="hs-identifier hs-var">e'</span></a></span><span>
</span><span id="line-238"></span><span>        </span><span class="hs-comment">-- We don't need to be concerned about floats when looking for coerce.</span><span>
</span><span id="line-239"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864968"><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680864968"><span class="hs-identifier hs-var">altcon</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864967"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864967"><span class="hs-identifier hs-var">bs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864966"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864966"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">AltCon -&gt; [Alt Var] -&gt; Maybe (Alt Var)
forall a b. AltCon -&gt; [(AltCon, a, b)] -&gt; Maybe (AltCon, a, b)
</span><a href="GHC.Core.Utils.html#findAlt"><span class="hs-identifier hs-var">findAlt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; AltCon
</span><a href="GHC.Core.html#DataAlt"><span class="hs-identifier hs-var">DataAlt</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864972"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Alt Var]
</span><a href="#local-6989586621680864974"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-240"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680864968"><span class="hs-identifier hs-var">altcon</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-241"></span><span>          </span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864966"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-242"></span><span>          </span><span class="annot"><span class="annottext">AltCon
</span><span class="hs-identifier">_</span></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Maybe (Var, Expr Var) -&gt; Expr Var -&gt; Expr Var)
-&gt; Expr Var -&gt; [Maybe (Var, Expr Var)] -&gt; Expr Var
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var) -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#wrapLet"><span class="hs-identifier hs-var">wrapLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864960"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864966"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Maybe (Var, Expr Var)]
</span><a href="#local-6989586621680864959"><span class="hs-identifier hs-var">mb_prs</span></a></span><span>
</span><span id="line-243"></span><span>            </span><span class="hs-keyword">where</span><span>
</span><span id="line-244"></span><span>              </span><span class="hs-special">(</span><span id="local-6989586621680864960"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864960"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864959"><span class="annot"><span class="annottext">[Maybe (Var, Expr Var)]
</span><a href="#local-6989586621680864959"><span class="hs-identifier hs-var">mb_prs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SimpleOptEnv
 -&gt; (Var, Expr Var) -&gt; (SimpleOptEnv, Maybe (Var, Expr Var)))
-&gt; SimpleOptEnv
-&gt; [(Var, Expr Var)]
-&gt; (SimpleOptEnv, [Maybe (Var, Expr Var)])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; SimpleOptEnv
-&gt; (Var, Expr Var)
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_out_bind"><span class="hs-identifier hs-var">simple_out_bind</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">([(Var, Expr Var)] -&gt; (SimpleOptEnv, [Maybe (Var, Expr Var)]))
-&gt; [(Var, Expr Var)] -&gt; (SimpleOptEnv, [Maybe (Var, Expr Var)])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-245"></span><span>                               </span><span class="annot"><span class="annottext">String -&gt; [Var] -&gt; [Expr Var] -&gt; [(Var, Expr Var)]
forall a b. String -&gt; [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="GHC.Utils.Misc.html#zipEqual"><span class="hs-identifier hs-var">zipEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;simpleOptExpr&quot;</span></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864967"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864970"><span class="hs-identifier hs-var">es</span></a></span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span>         </span><span class="hs-comment">-- Note [Getting the map/coerce RULE to work]</span><span>
</span><span id="line-248"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Id.html#isDeadBinder"><span class="hs-identifier hs-var">isDeadBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864976"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-249"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">AltCon
</span><a href="GHC.Core.html#DEFAULT"><span class="hs-identifier hs-var">DEFAULT</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Var]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864954"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864954"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Alt Var]
</span><a href="#local-6989586621680864974"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-250"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isCoVarType"><span class="hs-identifier hs-var">isCoVarType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Type
</span><a href="GHC.Types.Var.html#varType"><span class="hs-identifier hs-var hs-var">varType</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864976"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-251"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864951"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864951"><span class="hs-identifier hs-var">fun</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864950"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864950"><span class="hs-identifier hs-var">_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; (Expr Var, [Expr Var])
forall b. Expr b -&gt; (Expr b, [Expr b])
</span><a href="GHC.Core.html#collectArgs"><span class="hs-identifier hs-var">collectArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864977"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-252"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864951"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#coercibleSCSelIdKey"><span class="hs-identifier hs-var">coercibleSCSelIdKey</span></a></span><span>
</span><span id="line-253"></span><span>         </span><span class="hs-comment">-- without this last check, we get #11230</span><span>
</span><span id="line-254"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864954"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-257"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Var -&gt; Type -&gt; [Alt Var] -&gt; Expr Var
forall b. Expr b -&gt; b -&gt; Type -&gt; [Alt b] -&gt; Expr b
</span><a href="GHC.Core.html#Case"><span class="hs-identifier hs-var">Case</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864969"><span class="hs-identifier hs-var">e'</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864946"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Type -&gt; Type
</span><a href="GHC.Core.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864975"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-258"></span><span>                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Alt Var -&gt; Alt Var) -&gt; [Alt Var] -&gt; [Alt Var]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Alt Var -&gt; Alt Var
forall {a}.
SimpleOptEnv -&gt; (a, [Var], Expr Var) -&gt; (a, [Var], Expr Var)
</span><a href="#local-6989586621680864945"><span class="hs-identifier hs-var">go_alt</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864944"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Alt Var]
</span><a href="#local-6989586621680864974"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-260"></span><span>        </span><span id="local-6989586621680864969"><span class="annot"><span class="annottext">e' :: Expr Var
</span><a href="#local-6989586621680864969"><span class="hs-identifier hs-var hs-var">e'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680865031"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864977"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-261"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864944"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864944"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864946"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864946"><span class="hs-identifier hs-var">b'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-var">subst_opt_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864976"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span>    </span><span class="hs-comment">----------------------</span><span>
</span><span id="line-264"></span><span>    </span><span id="local-6989586621680865000"><span class="annot"><span class="annottext">go_co :: CoercionR -&gt; CoercionR
</span><a href="#local-6989586621680865000"><span class="hs-identifier hs-var hs-var">go_co</span></a></span></span><span> </span><span id="local-6989586621680864942"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864942"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TCvSubst -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier hs-var">optCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var hs-var">soe_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680865033"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; TCvSubst
</span><a href="GHC.Core.Subst.html#getTCvSubst"><span class="hs-identifier hs-var">getTCvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680865030"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864942"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span>    </span><span class="hs-comment">----------------------</span><span>
</span><span id="line-267"></span><span>    </span><span id="local-6989586621680864945"><span class="annot"><span class="annottext">go_alt :: SimpleOptEnv -&gt; (a, [Var], Expr Var) -&gt; (a, [Var], Expr Var)
</span><a href="#local-6989586621680864945"><span class="hs-identifier hs-var hs-var">go_alt</span></a></span></span><span> </span><span id="local-6989586621680864938"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864938"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864937"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680864937"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864936"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864936"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864935"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864935"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680864937"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864934"><span class="hs-identifier hs-var">bndrs'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864933"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864935"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-270"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864933"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864933"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864934"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864934"><span class="hs-identifier hs-var">bndrs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; [Var] -&gt; (SimpleOptEnv, [Var])
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndrs"><span class="hs-identifier hs-var">subst_opt_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864938"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864936"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span>    </span><span class="hs-comment">----------------------</span><span>
</span><span id="line-273"></span><span>    </span><span class="hs-comment">-- go_lam tries eta reduction</span><span>
</span><span id="line-274"></span><span>    </span><span id="local-6989586621680864979"><span class="annot"><span class="annottext">go_lam :: SimpleOptEnv -&gt; [Var] -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864979"><span class="hs-identifier hs-var hs-var">go_lam</span></a></span></span><span> </span><span id="local-6989586621680864931"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864931"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864930"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864930"><span class="hs-identifier hs-var">bs'</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864929"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864929"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864928"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864928"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; [Var] -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864979"><span class="hs-identifier hs-var">go_lam</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864927"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864926"><span class="hs-identifier hs-var">b'</span></a></span><span class="annot"><span class="annottext">Var -&gt; [Var] -&gt; [Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864930"><span class="hs-identifier hs-var">bs'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864928"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-276"></span><span>       </span><span class="hs-keyword">where</span><span>
</span><span id="line-277"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621680864927"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864927"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864926"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864926"><span class="hs-identifier hs-var">b'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-var">subst_opt_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864931"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864929"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-278"></span><span>    </span><span class="annot"><a href="#local-6989586621680864979"><span class="hs-identifier hs-var">go_lam</span></a></span><span> </span><span id="local-6989586621680864925"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864925"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864924"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864924"><span class="hs-identifier hs-var">bs'</span></a></span></span><span> </span><span id="local-6989586621680864923"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864923"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-279"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864922"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864922"><span class="hs-identifier hs-var">etad_e</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; Maybe (Expr Var)
</span><a href="GHC.Core.Utils.html#tryEtaReduce"><span class="hs-identifier hs-var">tryEtaReduce</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864920"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864919"><span class="hs-identifier hs-var">e'</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864922"><span class="hs-identifier hs-var">etad_e</span></a></span><span>
</span><span id="line-280"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; Expr Var
forall b. [b] -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#mkLams"><span class="hs-identifier hs-var">mkLams</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864920"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864919"><span class="hs-identifier hs-var">e'</span></a></span><span>
</span><span id="line-281"></span><span>       </span><span class="hs-keyword">where</span><span>
</span><span id="line-282"></span><span>         </span><span id="local-6989586621680864920"><span class="annot"><span class="annottext">bs :: [Var]
</span><a href="#local-6989586621680864920"><span class="hs-identifier hs-var hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Var]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864924"><span class="hs-identifier hs-var">bs'</span></a></span><span>
</span><span id="line-283"></span><span>         </span><span id="local-6989586621680864919"><span class="annot"><span class="annottext">e' :: Expr Var
</span><a href="#local-6989586621680864919"><span class="hs-identifier hs-var hs-var">e'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864925"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864923"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-type">mk_cast</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-286"></span><span class="hs-comment">-- Like GHC.Core.Utils.mkCast, but does a full reflexivity check.</span><span>
</span><span id="line-287"></span><span class="hs-comment">-- mkCast doesn't do that because the Simplifier does (in simplCast)</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- But in SimpleOpt it's nice to kill those nested casts (#18112)</span><span>
</span><span id="line-289"></span><span id="mk_cast"><span class="annot"><span class="annottext">mk_cast :: Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var hs-var">mk_cast</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864915"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864915"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864914"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864914"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864913"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864913"><span class="hs-identifier hs-var">co2</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var">mk_cast</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864915"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864914"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864913"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var">mk_cast</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680864911"><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864911"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680864910"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864910"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>   </span><span id="local-6989586621680864909"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864909"><span class="hs-identifier hs-var">co</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; Expr Var -&gt; Expr Var
forall b. Tickish Var -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-var">Tick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864911"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var">mk_cast</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864910"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864909"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#mk_cast"><span class="hs-identifier hs-var">mk_cast</span></a></span><span> </span><span id="local-6989586621680864908"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864908"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864907"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864907"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflexiveCo"><span class="hs-identifier hs-var">isReflexiveCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864907"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864908"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-292"></span><span>             </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
forall b. Expr b -&gt; CoercionR -&gt; Expr b
</span><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-var">Cast</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864908"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864907"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-293"></span><span>
</span><span id="line-294"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-295"></span><span class="hs-comment">-- simple_app collects arguments for beta reduction</span><span>
</span><span id="line-296"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-type">simple_app</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-type">SimpleClo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span id="simple_app"><span class="annot"><span class="annottext">simple_app :: HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var hs-var">simple_app</span></a></span></span><span> </span><span id="local-6989586621680864895"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864894"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864893"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864893"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-299"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864892"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864892"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864891"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864891"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo -&gt; Var -&gt; Maybe SimpleClo
forall a. VarEnv a -&gt; Var -&gt; Maybe a
</span><a href="GHC.Types.Var.Env.html#lookupVarEnv"><span class="hs-identifier hs-var">lookupVarEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var hs-var">soe_inl</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-300"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeSetInScope"><span class="hs-identifier hs-var">soeSetInScope</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864892"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864891"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864893"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864890"><span class="annot"><span class="annottext">unf :: Unfolding
</span><a href="#local-6989586621680864890"><span class="hs-identifier hs-var hs-var">unf</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Types.Id.html#idUnfolding"><span class="hs-identifier hs-var">idUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Bool
</span><a href="GHC.Core.html#isCompulsoryUnfolding"><span class="hs-identifier hs-var">isCompulsoryUnfolding</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Types.Id.html#idUnfolding"><span class="hs-identifier hs-var">idUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Activation -&gt; Bool
</span><a href="GHC.Types.Basic.html#isAlwaysActive"><span class="hs-identifier hs-var">isAlwaysActive</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Activation
</span><a href="GHC.Types.Id.html#idInlineActivation"><span class="hs-identifier hs-var">idInlineActivation</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-305"></span><span>    </span><span class="hs-comment">-- See Note [Unfold compulsory unfoldings in LHSs]</span><span>
</span><span id="line-306"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeZapSubst"><span class="hs-identifier hs-var">soeZapSubst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Unfolding -&gt; Expr Var
</span><a href="GHC.Core.html#unfoldingTemplate"><span class="hs-identifier hs-var">unfoldingTemplate</span></a></span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864890"><span class="hs-identifier hs-var">unf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864893"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-309"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864883"><span class="annot"><span class="annottext">out_fn :: Expr Var
</span><a href="#local-6989586621680864883"><span class="hs-identifier hs-var hs-var">out_fn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Var -&gt; Expr Var
Subst -&gt; Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#lookupIdSubst"><span class="hs-identifier hs-var">lookupIdSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864894"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var">finish_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864895"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864883"><span class="hs-identifier hs-var">out_fn</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864893"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-311"></span><span>
</span><span id="line-312"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span id="local-6989586621680864881"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864881"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span id="local-6989586621680864880"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864880"><span class="hs-identifier hs-var">e1</span></a></span></span><span> </span><span id="local-6989586621680864879"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864879"><span class="hs-identifier hs-var">e2</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864878"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864878"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-313"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864881"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864880"><span class="hs-identifier hs-var">e1</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864881"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864879"><span class="hs-identifier hs-var">e2</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SimpleClo -&gt; [SimpleClo] -&gt; [SimpleClo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864878"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span id="local-6989586621680864877"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864877"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864876"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864876"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864875"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864875"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864874"><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864874"><span class="hs-identifier hs-var">a</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680864873"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864873"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var) -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#wrapLet"><span class="hs-identifier hs-var">wrapLet</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864872"><span class="hs-identifier hs-var">mb_pr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864871"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864875"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864873"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-318"></span><span>     </span><span class="hs-special">(</span><span id="local-6989586621680864871"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864871"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864872"><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864872"><span class="hs-identifier hs-var">mb_pr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; SimpleClo
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_bind_pair"><span class="hs-identifier hs-var">simple_bind_pair</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864877"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864876"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Var
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864874"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span>
</span><span id="line-319"></span><span>
</span><span id="line-320"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span id="local-6989586621680864869"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864869"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680864868"><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864868"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680864867"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864867"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864866"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864866"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-321"></span><span>  </span><span class="hs-comment">-- Okay to do &quot;(Tick t e) x ==&gt; Tick t (e x)&quot;?</span><span>
</span><span id="line-322"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864868"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; TickishScoping -&gt; Bool
forall id. Tickish id -&gt; TickishScoping -&gt; Bool
</span><a href="GHC.Core.html#tickishScopesLike"><span class="hs-operator hs-var">`tickishScopesLike`</span></a></span><span> </span><span class="annot"><span class="annottext">TickishScoping
</span><a href="GHC.Core.html#SoftScope"><span class="hs-identifier hs-var">SoftScope</span></a></span><span>
</span><span id="line-323"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkTick"><span class="hs-identifier hs-var">mkTick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864868"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">(Expr Var -&gt; Expr Var) -&gt; Expr Var -&gt; Expr Var
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864869"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864867"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864866"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-comment">-- (let x = e in b) a1 .. an  =&gt;  let x = e in (b a1 .. an)</span><span>
</span><span id="line-326"></span><span class="hs-comment">-- The let might appear there as a result of inlining</span><span>
</span><span id="line-327"></span><span class="hs-comment">-- e.g.   let f = let x = e in b</span><span>
</span><span id="line-328"></span><span class="hs-comment">--        in f a1 a2</span><span>
</span><span id="line-329"></span><span class="hs-comment">--   (#13208)</span><span>
</span><span id="line-330"></span><span class="hs-comment">-- However, do /not/ do this transformation for join points</span><span>
</span><span id="line-331"></span><span class="hs-comment">--    See Note [simple_app and join points]</span><span>
</span><span id="line-332"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span id="local-6989586621680864863"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864863"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Let"><span class="hs-identifier hs-type">Let</span></a></span><span> </span><span id="local-6989586621680864862"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864862"><span class="hs-identifier hs-var">bind</span></a></span></span><span> </span><span id="local-6989586621680864861"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864861"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864860"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864860"><span class="hs-identifier hs-var">args</span></a></span></span><span>
</span><span id="line-333"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; InBind -&gt; TopLevelFlag -&gt; (SimpleOptEnv, Maybe InBind)
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-var">simple_opt_bind</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864863"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864862"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-334"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680864859"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864859"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe InBind
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864859"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864861"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864860"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-335"></span><span>      </span><span class="hs-special">(</span><span id="local-6989586621680864858"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864858"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864857"><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864857"><span class="hs-identifier hs-var">bind'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-336"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Bool
</span><a href="GHC.Core.Utils.html#isJoinBind"><span class="hs-identifier hs-var">isJoinBind</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864857"><span class="hs-identifier hs-var">bind'</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var">finish_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864863"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864855"><span class="hs-identifier hs-var">expr'</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864860"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-337"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Expr Var -&gt; Expr Var
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864857"><span class="hs-identifier hs-var">bind'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864858"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864861"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864860"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-338"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-339"></span><span>          </span><span id="local-6989586621680864855"><span class="annot"><span class="annottext">expr' :: Expr Var
</span><a href="#local-6989586621680864855"><span class="hs-identifier hs-var hs-var">expr'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Expr Var -&gt; Expr Var
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="annot"><span class="annottext">InBind
</span><a href="#local-6989586621680864857"><span class="hs-identifier hs-var">bind'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864858"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864861"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_app"><span class="hs-identifier hs-var">simple_app</span></a></span><span> </span><span id="local-6989586621680864852"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864852"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864851"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864851"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864850"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864850"><span class="hs-keyword hs-var">as</span></a></span></span><span>
</span><span id="line-342"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var">finish_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864852"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864852"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864851"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864850"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-type">finish_app</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-type">SimpleClo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span>
</span><span id="line-345"></span><span id="finish_app"><span class="annot"><span class="annottext">finish_app :: SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var hs-var">finish_app</span></a></span></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680864849"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864849"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-346"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864849"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-347"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var">finish_app</span></a></span><span> </span><span id="local-6989586621680864848"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864848"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864847"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864847"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864846"><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864846"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680864845"><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864845"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-348"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Expr Var -&gt; [SimpleClo] -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#finish_app"><span class="hs-identifier hs-var">finish_app</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864848"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; Expr Var -&gt; Expr Var
forall b. Expr b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#App"><span class="hs-identifier hs-var">App</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864847"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleClo -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_clo"><span class="hs-identifier hs-var">simple_opt_clo</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864848"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864846"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[SimpleClo]
</span><a href="#local-6989586621680864845"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-349"></span><span>
</span><span id="line-350"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-351"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-type">simple_opt_bind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InBind"><span class="hs-identifier hs-type">InBind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-352"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.html#OutBind"><span class="hs-identifier hs-type">OutBind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-353"></span><span id="simple_opt_bind"><span class="annot"><span class="annottext">simple_opt_bind :: SimpleOptEnv
-&gt; InBind -&gt; TopLevelFlag -&gt; (SimpleOptEnv, Maybe InBind)
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-var hs-var">simple_opt_bind</span></a></span></span><span> </span><span id="local-6989586621680864843"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864843"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621680864841"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864841"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864840"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864840"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864839"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864839"><span class="hs-identifier hs-var">top_level</span></a></span></span><span>
</span><span id="line-354"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864838"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864837"><span class="hs-identifier hs-var">mb_pr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-355"></span><span>            </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe InBind
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-356"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864836"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864836"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864835"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864835"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Maybe InBind
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; InBind
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864836"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864835"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-357"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-358"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864834"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864834"><span class="hs-identifier hs-var">b'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864833"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864833"><span class="hs-identifier hs-var">r'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; Maybe (Var, Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#joinPointBinding_maybe"><span class="hs-identifier hs-var">joinPointBinding_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864841"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864840"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var) -&gt; (Var, Expr Var) -&gt; (Var, Expr Var)
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864841"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864840"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-359"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864838"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864838"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864837"><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864837"><span class="hs-identifier hs-var">mb_pr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; SimpleClo
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_bind_pair"><span class="hs-identifier hs-var">simple_bind_pair</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864843"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864834"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Var
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864843"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864833"><span class="hs-identifier hs-var">r'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864839"><span class="hs-identifier hs-var">top_level</span></a></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_opt_bind"><span class="hs-identifier hs-var">simple_opt_bind</span></a></span><span> </span><span id="local-6989586621680864832"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864832"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Rec"><span class="hs-identifier hs-type">Rec</span></a></span><span> </span><span id="local-6989586621680864830"><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864830"><span class="hs-identifier hs-var">prs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864829"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864829"><span class="hs-identifier hs-var">top_level</span></a></span></span><span>
</span><span id="line-362"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864828"><span class="hs-identifier hs-var">env''</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe InBind
</span><a href="#local-6989586621680864827"><span class="hs-identifier hs-var">res_bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-363"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-364"></span><span>    </span><span id="local-6989586621680864827"><span class="annot"><span class="annottext">res_bind :: Maybe InBind
</span><a href="#local-6989586621680864827"><span class="hs-identifier hs-var hs-var">res_bind</span></a></span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Maybe InBind
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Var, Expr Var)] -&gt; InBind
forall b. [(b, Expr b)] -&gt; Bind b
</span><a href="GHC.Core.html#Rec"><span class="hs-identifier hs-var">Rec</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Var, Expr Var)] -&gt; [(Var, Expr Var)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864826"><span class="hs-identifier hs-var">rev_prs'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-365"></span><span>    </span><span id="local-6989586621680864825"><span class="annot"><span class="annottext">prs' :: [(Var, Expr Var)]
</span><a href="#local-6989586621680864825"><span class="hs-identifier hs-var hs-var">prs'</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)] -&gt; Maybe [(Var, Expr Var)]
</span><a href="GHC.Core.SimpleOpt.html#joinPointBindings_maybe"><span class="hs-identifier hs-var">joinPointBindings_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864830"><span class="hs-identifier hs-var">prs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe [(Var, Expr Var)] -&gt; [(Var, Expr Var)] -&gt; [(Var, Expr Var)]
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864830"><span class="hs-identifier hs-var">prs</span></a></span><span>
</span><span id="line-366"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864824"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864824"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864823"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864823"><span class="hs-identifier hs-var">bndrs'</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; [Var] -&gt; (SimpleOptEnv, [Var])
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndrs"><span class="hs-identifier hs-var">subst_opt_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864832"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Var, Expr Var) -&gt; Var) -&gt; [(Var, Expr Var)] -&gt; [Var]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; Var
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864825"><span class="hs-identifier hs-var">prs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-367"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864828"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864828"><span class="hs-identifier hs-var">env''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864826"><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864826"><span class="hs-identifier hs-var">rev_prs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((SimpleOptEnv, [(Var, Expr Var)])
 -&gt; ((Var, Expr Var), Var) -&gt; (SimpleOptEnv, [(Var, Expr Var)]))
-&gt; (SimpleOptEnv, [(Var, Expr Var)])
-&gt; [((Var, Expr Var), Var)]
-&gt; (SimpleOptEnv, [(Var, Expr Var)])
forall (t :: * -&gt; *) b a.
Foldable t =&gt;
(b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldl%27"><span class="hs-identifier hs-var">foldl'</span></a></span><span> </span><span class="annot"><span class="annottext">(SimpleOptEnv, [(Var, Expr Var)])
-&gt; ((Var, Expr Var), Var) -&gt; (SimpleOptEnv, [(Var, Expr Var)])
</span><a href="#local-6989586621680864821"><span class="hs-identifier hs-var">do_pr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864824"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864825"><span class="hs-identifier hs-var">prs'</span></a></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)] -&gt; [Var] -&gt; [((Var, Expr Var), Var)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864823"><span class="hs-identifier hs-var">bndrs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-368"></span><span>    </span><span id="local-6989586621680864821"><span class="annot"><span class="annottext">do_pr :: (SimpleOptEnv, [(Var, Expr Var)])
-&gt; ((Var, Expr Var), Var) -&gt; (SimpleOptEnv, [(Var, Expr Var)])
</span><a href="#local-6989586621680864821"><span class="hs-identifier hs-var hs-var">do_pr</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864820"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864820"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864819"><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864819"><span class="hs-identifier hs-var">prs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621680864818"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864818"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864817"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864817"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864816"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864816"><span class="hs-identifier hs-var">b'</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-369"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864815"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864814"><span class="hs-identifier hs-var">mb_pr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-370"></span><span>                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864813"><span class="annot"><span class="annottext">(Var, Expr Var)
</span><a href="#local-6989586621680864813"><span class="hs-identifier hs-var">pr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var)
</span><a href="#local-6989586621680864813"><span class="hs-identifier hs-var">pr</span></a></span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; [(Var, Expr Var)] -&gt; [(Var, Expr Var)]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864819"><span class="hs-identifier hs-var">prs</span></a></span><span>
</span><span id="line-371"></span><span>                  </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864819"><span class="hs-identifier hs-var">prs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-372"></span><span>       </span><span class="hs-keyword">where</span><span>
</span><span id="line-373"></span><span>         </span><span class="hs-special">(</span><span id="local-6989586621680864815"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864815"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864814"><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="#local-6989586621680864814"><span class="hs-identifier hs-var">mb_pr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; SimpleClo
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_bind_pair"><span class="hs-identifier hs-var">simple_bind_pair</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864820"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864818"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Maybe Var
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864816"><span class="hs-identifier hs-var">b'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864820"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864817"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864829"><span class="hs-identifier hs-var">top_level</span></a></span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-376"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_bind_pair"><span class="hs-identifier hs-type">simple_bind_pair</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-377"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InVar"><span class="hs-identifier hs-type">InVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span>
</span><span id="line-378"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleClo"><span class="hs-identifier hs-type">SimpleClo</span></a></span><span>
</span><span id="line-379"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-380"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-381"></span><span>    </span><span class="hs-comment">-- (simple_bind_pair subst in_var out_rhs)</span><span>
</span><span id="line-382"></span><span>    </span><span class="hs-comment">--   either extends subst with (in_var -&gt; out_rhs)</span><span>
</span><span id="line-383"></span><span>    </span><span class="hs-comment">--   or     returns Nothing</span><span>
</span><span id="line-384"></span><span id="simple_bind_pair"><span class="annot"><span class="annottext">simple_bind_pair :: SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; SimpleClo
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_bind_pair"><span class="hs-identifier hs-var hs-var">simple_bind_pair</span></a></span></span><span> </span><span id="local-6989586621680864810"><span class="annot"><span class="annottext">env :: SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_inl :: SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864809"><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680864809"><span class="hs-identifier hs-var">inl_env</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864808"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864808"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-385"></span><span>                 </span><span id="local-6989586621680864807"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span></span><span> </span><span id="local-6989586621680864806"><span class="annot"><span class="annottext">Maybe Var
</span><a href="#local-6989586621680864806"><span class="hs-identifier hs-var">mb_out_bndr</span></a></span></span><span> </span><span id="local-6989586621680864805"><span class="annot"><span class="annottext">clo :: SimpleClo
</span><a href="#local-6989586621680864805"><span class="hs-identifier hs-var">clo</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680864804"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864804"><span class="hs-identifier hs-var">rhs_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864803"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864803"><span class="hs-identifier hs-var">in_rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-386"></span><span>                 </span><span id="local-6989586621680864802"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864802"><span class="hs-identifier hs-var">top_level</span></a></span></span><span>
</span><span id="line-387"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621680864801"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864801"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864803"><span class="hs-identifier hs-var">in_rhs</span></a></span><span>        </span><span class="hs-comment">-- let a::* = TYPE ty in &lt;body&gt;</span><span>
</span><span id="line-388"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864800"><span class="annot"><span class="annottext">out_ty :: Type
</span><a href="#local-6989586621680864800"><span class="hs-identifier hs-var hs-var">out_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Type -&gt; Type
</span><a href="GHC.Core.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864804"><span class="hs-identifier hs-var">rhs_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864801"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-389"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-identifier">in_bndr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_rhs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-390"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Type -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendTvSubst"><span class="hs-identifier hs-var">extendTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864808"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864800"><span class="hs-identifier hs-var">out_ty</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span id="local-6989586621680864793"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864793"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864803"><span class="hs-identifier hs-var">in_rhs</span></a></span><span>
</span><span id="line-393"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864792"><span class="annot"><span class="annottext">out_co :: CoercionR
</span><a href="#local-6989586621680864792"><span class="hs-identifier hs-var hs-var">out_co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; TCvSubst -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.Opt.html#optCoercion"><span class="hs-identifier hs-var">optCoercion</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var hs-var">soe_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; TCvSubst
</span><a href="GHC.Core.Subst.html#getTCvSubst"><span class="hs-identifier hs-var">getTCvSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864804"><span class="hs-identifier hs-var">rhs_env</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864793"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-394"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isCoVar</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-395"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; CoercionR -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendCvSubst"><span class="hs-identifier hs-var">extendCvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864808"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864792"><span class="hs-identifier hs-var">out_co</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isNonCoVarId</span><span> </span><span class="hs-identifier">in_bndr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-398"></span><span>    </span><span class="hs-comment">-- The previous two guards got rid of tyvars and coercions</span><span>
</span><span id="line-399"></span><span>    </span><span class="hs-comment">-- See Note [Core type and coercion invariant] in GHC.Core</span><span>
</span><span id="line-400"></span><span>    </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864788"><span class="hs-identifier hs-var">pre_inline_unconditionally</span></a></span><span>
</span><span id="line-401"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_inl :: IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo -&gt; Var -&gt; SimpleClo -&gt; IdEnv SimpleClo
forall a. VarEnv a -&gt; Var -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnv"><span class="hs-identifier hs-var">extendVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680864809"><span class="hs-identifier hs-var">inl_env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864805"><span class="hs-identifier hs-var">clo</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-404"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; Expr Var
-&gt; OccInfo
-&gt; Bool
-&gt; Bool
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_out_bind_pair"><span class="hs-identifier hs-var">simple_out_bind_pair</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Var
</span><a href="#local-6989586621680864806"><span class="hs-identifier hs-var">mb_out_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864785"><span class="hs-identifier hs-var">out_rhs</span></a></span><span>
</span><span id="line-405"></span><span>                         </span><span class="annot"><span class="annottext">OccInfo
</span><a href="#local-6989586621680864784"><span class="hs-identifier hs-var">occ</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864783"><span class="hs-identifier hs-var">active</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864782"><span class="hs-identifier hs-var">stable_unf</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864802"><span class="hs-identifier hs-var">top_level</span></a></span><span>
</span><span id="line-406"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-407"></span><span>    </span><span id="local-6989586621680864782"><span class="annot"><span class="annottext">stable_unf :: Bool
</span><a href="#local-6989586621680864782"><span class="hs-identifier hs-var hs-var">stable_unf</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Bool
</span><a href="GHC.Core.html#isStableUnfolding"><span class="hs-identifier hs-var">isStableUnfolding</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Types.Id.html#idUnfolding"><span class="hs-identifier hs-var">idUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-408"></span><span>    </span><span id="local-6989586621680864783"><span class="annot"><span class="annottext">active :: Bool
</span><a href="#local-6989586621680864783"><span class="hs-identifier hs-var hs-var">active</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Activation -&gt; Bool
</span><a href="GHC.Types.Basic.html#isAlwaysActive"><span class="hs-identifier hs-var">isAlwaysActive</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Activation
</span><a href="GHC.Types.Id.html#idInlineActivation"><span class="hs-identifier hs-var">idInlineActivation</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-409"></span><span>    </span><span id="local-6989586621680864784"><span class="annot"><span class="annottext">occ :: OccInfo
</span><a href="#local-6989586621680864784"><span class="hs-identifier hs-var hs-var">occ</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; OccInfo
</span><a href="GHC.Types.Id.html#idOccInfo"><span class="hs-identifier hs-var">idOccInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span>    </span><span id="local-6989586621680864785"><span class="annot"><span class="annottext">out_rhs :: Expr Var
</span><a href="#local-6989586621680864785"><span class="hs-identifier hs-var hs-var">out_rhs</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864779"><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864779"><span class="hs-identifier hs-var">join_arity</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Maybe BranchCount
</span><a href="GHC.Types.Id.html#isJoinId_maybe"><span class="hs-identifier hs-var">isJoinId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span>
</span><span id="line-412"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; Expr Var
</span><a href="#local-6989586621680864777"><span class="hs-identifier hs-var">simple_join_rhs</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864779"><span class="hs-identifier hs-var">join_arity</span></a></span><span>
</span><span id="line-413"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-414"></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleClo -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_clo"><span class="hs-identifier hs-var">simple_opt_clo</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleClo
</span><a href="#local-6989586621680864805"><span class="hs-identifier hs-var">clo</span></a></span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span>    </span><span id="local-6989586621680864777"><span class="annot"><span class="annottext">simple_join_rhs :: BranchCount -&gt; Expr Var
</span><a href="#local-6989586621680864777"><span class="hs-identifier hs-var hs-var">simple_join_rhs</span></a></span></span><span> </span><span id="local-6989586621680864774"><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864774"><span class="hs-identifier hs-var">join_arity</span></a></span></span><span> </span><span class="hs-comment">-- See Note [Preserve join-binding arity]</span><span>
</span><span id="line-417"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; Expr Var
forall b. [b] -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#mkLams"><span class="hs-identifier hs-var">mkLams</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864773"><span class="hs-identifier hs-var">join_bndrs'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasCallStack =&gt; SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
SimpleOptEnv -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simple_opt_expr"><span class="hs-identifier hs-var">simple_opt_expr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864772"><span class="hs-identifier hs-var">env_body</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864771"><span class="hs-identifier hs-var">join_body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-418"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-419"></span><span>        </span><span id="local-6989586621680864770"><span class="annot"><span class="annottext">env0 :: SimpleOptEnv
</span><a href="#local-6989586621680864770"><span class="hs-identifier hs-var hs-var">env0</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; SimpleOptEnv -&gt; SimpleOptEnv
</span><a href="GHC.Core.SimpleOpt.html#soeSetInScope"><span class="hs-identifier hs-var">soeSetInScope</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864810"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864804"><span class="hs-identifier hs-var">rhs_env</span></a></span><span>
</span><span id="line-420"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864769"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864769"><span class="hs-identifier hs-var">join_bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864771"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864771"><span class="hs-identifier hs-var">join_body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; Expr Var -&gt; ([Var], Expr Var)
forall b. BranchCount -&gt; Expr b -&gt; ([b], Expr b)
</span><a href="GHC.Core.html#collectNBinders"><span class="hs-identifier hs-var">collectNBinders</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864774"><span class="hs-identifier hs-var">join_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864803"><span class="hs-identifier hs-var">in_rhs</span></a></span><span>
</span><span id="line-421"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864772"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864772"><span class="hs-identifier hs-var">env_body</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864773"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864773"><span class="hs-identifier hs-var">join_bndrs'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; [Var] -&gt; (SimpleOptEnv, [Var])
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndrs"><span class="hs-identifier hs-var">subst_opt_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864770"><span class="hs-identifier hs-var">env0</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864769"><span class="hs-identifier hs-var">join_bndrs</span></a></span><span>
</span><span id="line-422"></span><span>
</span><span id="line-423"></span><span>    </span><span class="annot"><a href="#local-6989586621680864788"><span class="hs-identifier hs-type">pre_inline_unconditionally</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-424"></span><span>    </span><span id="local-6989586621680864788"><span class="annot"><span class="annottext">pre_inline_unconditionally :: Bool
</span><a href="#local-6989586621680864788"><span class="hs-identifier hs-var hs-var">pre_inline_unconditionally</span></a></span></span><span>
</span><span id="line-425"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isExportedId"><span class="hs-identifier hs-var">isExportedId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864807"><span class="hs-identifier hs-var">in_bndr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-426"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864782"><span class="hs-identifier hs-var">stable_unf</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-427"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864783"><span class="hs-identifier hs-var">active</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>    </span><span class="hs-comment">-- Note [Inline prag in simplOpt]</span><span>
</span><span id="line-428"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">OccInfo -&gt; Bool
</span><a href="#local-6989586621680864766"><span class="hs-identifier hs-var">safe_to_inline</span></a></span><span> </span><span class="annot"><span class="annottext">OccInfo
</span><a href="#local-6989586621680864784"><span class="hs-identifier hs-var">occ</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-429"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-430"></span><span>
</span><span id="line-431"></span><span>        </span><span class="hs-comment">-- Unconditionally safe to inline</span><span>
</span><span id="line-432"></span><span>    </span><span class="annot"><a href="#local-6989586621680864766"><span class="hs-identifier hs-type">safe_to_inline</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#OccInfo"><span class="hs-identifier hs-type">OccInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-433"></span><span>    </span><span id="local-6989586621680864766"><span class="annot"><span class="annottext">safe_to_inline :: OccInfo -&gt; Bool
</span><a href="#local-6989586621680864766"><span class="hs-identifier hs-var hs-var">safe_to_inline</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#IAmALoopBreaker"><span class="hs-identifier hs-type">IAmALoopBreaker</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-434"></span><span>    </span><span class="annot"><a href="#local-6989586621680864766"><span class="hs-identifier hs-var">safe_to_inline</span></a></span><span> </span><span class="annot"><span class="annottext">OccInfo
</span><a href="GHC.Types.Basic.html#IAmDead"><span class="hs-identifier hs-var">IAmDead</span></a></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-435"></span><span>    </span><span class="annot"><a href="#local-6989586621680864766"><span class="hs-identifier hs-var">safe_to_inline</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#OneOcc"><span class="hs-identifier hs-type">OneOcc</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">occ_in_lam :: OccInfo -&gt; InsideLam
</span><a href="GHC.Types.Basic.html#occ_in_lam"><span class="hs-identifier hs-var">occ_in_lam</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InsideLam
</span><a href="GHC.Types.Basic.html#NotInsideLam"><span class="hs-identifier hs-var">NotInsideLam</span></a></span><span>
</span><span id="line-436"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">occ_n_br :: OccInfo -&gt; BranchCount
</span><a href="GHC.Types.Basic.html#occ_n_br"><span class="hs-identifier hs-var">occ_n_br</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><span class="hs-number">1</span></span><span> </span><span class="hs-special">}</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-437"></span><span>    </span><span class="annot"><a href="#local-6989586621680864766"><span class="hs-identifier hs-var">safe_to_inline</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#OneOcc"><span class="hs-identifier hs-type">OneOcc</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>                           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-438"></span><span>    </span><span class="annot"><a href="#local-6989586621680864766"><span class="hs-identifier hs-var">safe_to_inline</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#ManyOccs"><span class="hs-identifier hs-type">ManyOccs</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="hs-comment">-------------------</span><span>
</span><span id="line-441"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_out_bind"><span class="hs-identifier hs-type">simple_out_bind</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-442"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-443"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#InVar"><span class="hs-identifier hs-type">InVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-444"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span id="simple_out_bind"><span class="annot"><span class="annottext">simple_out_bind :: TopLevelFlag
-&gt; SimpleOptEnv
-&gt; (Var, Expr Var)
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_out_bind"><span class="hs-identifier hs-var hs-var">simple_out_bind</span></a></span></span><span> </span><span id="local-6989586621680864758"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864758"><span class="hs-identifier hs-var">top_level</span></a></span></span><span> </span><span id="local-6989586621680864757"><span class="annot"><span class="annottext">env :: SimpleOptEnv
</span><a href="#local-6989586621680864757"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864756"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864756"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864755"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864755"><span class="hs-identifier hs-var">in_bndr</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864754"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864754"><span class="hs-identifier hs-var">out_rhs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-446"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621680864753"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864753"><span class="hs-identifier hs-var">out_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864754"><span class="hs-identifier hs-var">out_rhs</span></a></span><span>
</span><span id="line-447"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-identifier">in_bndr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">out_ty</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">out_rhs</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-448"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864757"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Type -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendTvSubst"><span class="hs-identifier hs-var">extendTvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864756"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864755"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864753"><span class="hs-identifier hs-var">out_ty</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-449"></span><span>
</span><span id="line-450"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span> </span><span id="local-6989586621680864752"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864752"><span class="hs-identifier hs-var">out_co</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864754"><span class="hs-identifier hs-var">out_rhs</span></a></span><span>
</span><span id="line-451"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isCoVar</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-452"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864757"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; CoercionR -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendCvSubst"><span class="hs-identifier hs-var">extendCvSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864756"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864755"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864752"><span class="hs-identifier hs-var">out_co</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-455"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; Expr Var
-&gt; OccInfo
-&gt; Bool
-&gt; Bool
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_out_bind_pair"><span class="hs-identifier hs-var">simple_out_bind_pair</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864757"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864755"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Var
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864754"><span class="hs-identifier hs-var">out_rhs</span></a></span><span>
</span><span id="line-456"></span><span>                         </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; OccInfo
</span><a href="GHC.Types.Id.html#idOccInfo"><span class="hs-identifier hs-var">idOccInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864755"><span class="hs-identifier hs-var">in_bndr</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864758"><span class="hs-identifier hs-var">top_level</span></a></span><span>
</span><span id="line-457"></span><span>
</span><span id="line-458"></span><span class="hs-comment">-------------------</span><span>
</span><span id="line-459"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simple_out_bind_pair"><span class="hs-identifier hs-type">simple_out_bind_pair</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span>
</span><span id="line-460"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InId"><span class="hs-identifier hs-type">InId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutId"><span class="hs-identifier hs-type">OutId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span>
</span><span id="line-461"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#OccInfo"><span class="hs-identifier hs-type">OccInfo</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-462"></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-463"></span><span id="simple_out_bind_pair"><span class="annot"><span class="annottext">simple_out_bind_pair :: SimpleOptEnv
-&gt; Var
-&gt; Maybe Var
-&gt; Expr Var
-&gt; OccInfo
-&gt; Bool
-&gt; Bool
-&gt; TopLevelFlag
-&gt; (SimpleOptEnv, Maybe (Var, Expr Var))
</span><a href="GHC.Core.SimpleOpt.html#simple_out_bind_pair"><span class="hs-identifier hs-var hs-var">simple_out_bind_pair</span></a></span></span><span> </span><span id="local-6989586621680864749"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864749"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864748"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864748"><span class="hs-identifier hs-var">in_bndr</span></a></span></span><span> </span><span id="local-6989586621680864747"><span class="annot"><span class="annottext">Maybe Var
</span><a href="#local-6989586621680864747"><span class="hs-identifier hs-var">mb_out_bndr</span></a></span></span><span> </span><span id="local-6989586621680864746"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span></span><span>
</span><span id="line-464"></span><span>                     </span><span id="local-6989586621680864745"><span class="annot"><span class="annottext">OccInfo
</span><a href="#local-6989586621680864745"><span class="hs-identifier hs-var">occ_info</span></a></span></span><span> </span><span id="local-6989586621680864744"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864744"><span class="hs-identifier hs-var">active</span></a></span></span><span> </span><span id="local-6989586621680864743"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864743"><span class="hs-identifier hs-var">stable_unf</span></a></span></span><span> </span><span id="local-6989586621680864742"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864742"><span class="hs-identifier hs-var">top_level</span></a></span></span><span>
</span><span id="line-465"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isNonCoVarId</span><span> </span><span class="hs-identifier">in_bndr</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">in_bndr</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-466"></span><span>    </span><span class="hs-comment">-- Type and coercion bindings are caught earlier</span><span>
</span><span id="line-467"></span><span>    </span><span class="hs-comment">-- See Note [Core type and coercion invariant]</span><span>
</span><span id="line-468"></span><span>    </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864741"><span class="hs-identifier hs-var">post_inline_unconditionally</span></a></span><span>
</span><span id="line-469"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864740"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Expr Var -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendIdSubst"><span class="hs-identifier hs-var">extendIdSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864749"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864748"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-470"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-471"></span><span>
</span><span id="line-472"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-473"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864740"><span class="hs-identifier hs-var">env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864738"><span class="hs-identifier hs-var">out_bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-475"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864740"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864740"><span class="hs-identifier hs-var">env'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864737"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864737"><span class="hs-identifier hs-var">bndr1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe Var
</span><a href="#local-6989586621680864747"><span class="hs-identifier hs-var">mb_out_bndr</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-476"></span><span>                      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864736"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864736"><span class="hs-identifier hs-var">out_bndr</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864749"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864736"><span class="hs-identifier hs-var">out_bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-477"></span><span>                      </span><span class="annot"><span class="annottext">Maybe Var
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-var">subst_opt_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864749"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864748"><span class="hs-identifier hs-var">in_bndr</span></a></span><span>
</span><span id="line-478"></span><span>    </span><span id="local-6989586621680864738"><span class="annot"><span class="annottext">out_bndr :: Var
</span><a href="#local-6989586621680864738"><span class="hs-identifier hs-var hs-var">out_bndr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; TopLevelFlag -&gt; Expr Var -&gt; Var -&gt; Var
</span><a href="GHC.Core.SimpleOpt.html#add_info"><span class="hs-identifier hs-var">add_info</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864740"><span class="hs-identifier hs-var">env'</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864748"><span class="hs-identifier hs-var">in_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864742"><span class="hs-identifier hs-var">top_level</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864737"><span class="hs-identifier hs-var">bndr1</span></a></span><span>
</span><span id="line-479"></span><span>
</span><span id="line-480"></span><span>    </span><span class="annot"><a href="#local-6989586621680864741"><span class="hs-identifier hs-type">post_inline_unconditionally</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-481"></span><span>    </span><span id="local-6989586621680864741"><span class="annot"><span class="annottext">post_inline_unconditionally :: Bool
</span><a href="#local-6989586621680864741"><span class="hs-identifier hs-var hs-var">post_inline_unconditionally</span></a></span></span><span>
</span><span id="line-482"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isExportedId"><span class="hs-identifier hs-var">isExportedId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864748"><span class="hs-identifier hs-var">in_bndr</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- Note [Exported Ids and trivial RHSs]</span><span>
</span><span id="line-483"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864743"><span class="hs-identifier hs-var">stable_unf</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- Note [Stable unfoldings and postInlineUnconditionally]</span><span>
</span><span id="line-484"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864744"><span class="hs-identifier hs-var">active</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">--     in GHC.Core.Opt.Simplify.Utils</span><span>
</span><span id="line-485"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864734"><span class="hs-identifier hs-var">is_loop_breaker</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- If it's a loop-breaker of any kind, don't inline</span><span>
</span><span id="line-486"></span><span>                                       </span><span class="hs-comment">-- because it might be referred to &quot;earlier&quot;</span><span>
</span><span id="line-487"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Bool
</span><a href="GHC.Core.Utils.html#exprIsTrivial"><span class="hs-identifier hs-var">exprIsTrivial</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-488"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864732"><span class="hs-identifier hs-var">coercible_hack</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-489"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-490"></span><span>
</span><span id="line-491"></span><span>    </span><span id="local-6989586621680864734"><span class="annot"><span class="annottext">is_loop_breaker :: Bool
</span><a href="#local-6989586621680864734"><span class="hs-identifier hs-var hs-var">is_loop_breaker</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccInfo -&gt; Bool
</span><a href="GHC.Types.Basic.html#isWeakLoopBreaker"><span class="hs-identifier hs-var">isWeakLoopBreaker</span></a></span><span> </span><span class="annot"><span class="annottext">OccInfo
</span><a href="#local-6989586621680864745"><span class="hs-identifier hs-var">occ_info</span></a></span><span>
</span><span id="line-492"></span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-comment">-- See Note [Getting the map/coerce RULE to work]</span><span>
</span><span id="line-494"></span><span>    </span><span id="local-6989586621680864732"><span class="annot"><span class="annottext">coercible_hack :: Bool
</span><a href="#local-6989586621680864732"><span class="hs-identifier hs-var hs-var">coercible_hack</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864726"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864726"><span class="hs-identifier hs-var">fun</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864725"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864725"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; (Expr Var, [Expr Var])
forall b. Expr b -&gt; (Expr b, [Expr b])
</span><a href="GHC.Core.html#collectArgs"><span class="hs-identifier hs-var">collectArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864746"><span class="hs-identifier hs-var">out_rhs</span></a></span><span>
</span><span id="line-495"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864724"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864724"><span class="hs-identifier hs-var">dc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Maybe DataCon
</span><a href="GHC.Types.Id.html#isDataConWorkId_maybe"><span class="hs-identifier hs-var">isDataConWorkId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864726"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-496"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864724"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#heqDataConKey"><span class="hs-identifier hs-var">heqDataConKey</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864724"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#coercibleDataConKey"><span class="hs-identifier hs-var">coercibleDataConKey</span></a></span><span>
</span><span id="line-497"></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Expr Var -&gt; Bool) -&gt; [Expr Var] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Bool
</span><a href="GHC.Core.Utils.html#exprIsTrivial"><span class="hs-identifier hs-var">exprIsTrivial</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864725"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-498"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-499"></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-500"></span><span>
</span><span id="line-501"></span><span class="hs-comment">{- Note [Exported Ids and trivial RHSs]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We obviously do not want to unconditionally inline an Id that is exported.
In GHC.Core.Opt.Simplify.Utils, Note [Top level and postInlineUnconditionally], we
explain why we don't inline /any/ top-level things unconditionally, even
trivial ones.  But we do here!  Why?  In the simple optimiser

  * We do no rule rewrites
  * We do no call-site inlining

Those differences obviate the reasons for not inlining a trivial rhs,
and increase the benefit for doing so.  So we unconditionally inline trivial
rhss here.

Note [Preserve join-binding arity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Be careful /not/ to eta-reduce the RHS of a join point, lest we lose
the join-point arity invariant.  #15108 was caused by simplifying
the RHS with simple_opt_expr, which does eta-reduction.  Solution:
simplify the RHS of a join point by simplifying under the lambdas
(which of course should be there).

Note [simple_app and join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In general for let-bindings we can do this:
   (let { x = e } in b) a  ==&gt;  let { x = e } in b a

But not for join points!  For two reasons:

- We would need to push the continuation into the RHS:
   (join { j = e } in b) a  ==&gt;  let { j' = e a } in b[j'/j] a
                                      NB ----^^
  and also change the type of j, hence j'.
  That's a bit sophisticated for the very simple optimiser.

- We might end up with something like
    join { j' = e a } in
    (case blah of        )
    (  True  -&gt; j' void# ) a
    (  False -&gt; blah     )
  and now the call to j' doesn't look like a tail call, and
  Lint may reject.  I say &quot;may&quot; because this is /explicitly/
  allowed in the &quot;Compiling without Continuations&quot; paper
  (Section 3, &quot;Managing \Delta&quot;).  But GHC currently does not
  allow this slightly-more-flexible form.  See GHC.Core
  Note [Join points are less general than the paper].

The simple thing to do is to disable this transformation
for join points in the simple optimiser

Note [The Let-Unfoldings Invariant]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A program has the Let-Unfoldings property iff:

- For every let-bound variable f, whether top-level or nested, whether
  recursive or not:
  - Both the binding Id of f, and every occurrence Id of f, has an idUnfolding.
  - For non-INLINE things, that unfolding will be f's right hand sids
  - For INLINE things (which have a &quot;stable&quot; unfolding) that unfolding is
    semantically equivalent to f's RHS, but derived from the original RHS of f
    rather that its current RHS.

Informally, we can say that in a program that has the Let-Unfoldings property,
all let-bound Id's have an explicit unfolding attached to them.

Currently, the simplifier guarantees the Let-Unfoldings invariant for anything
it outputs.

-}</span><span>
</span><span id="line-570"></span><span>
</span><span id="line-571"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-572"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#subst_opt_bndrs"><span class="hs-identifier hs-type">subst_opt_bndrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InVar"><span class="hs-identifier hs-type">InVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-573"></span><span id="subst_opt_bndrs"><span class="annot"><span class="annottext">subst_opt_bndrs :: SimpleOptEnv -&gt; [Var] -&gt; (SimpleOptEnv, [Var])
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndrs"><span class="hs-identifier hs-var hs-var">subst_opt_bndrs</span></a></span></span><span> </span><span id="local-6989586621680864718"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864718"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864717"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864717"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var))
-&gt; SimpleOptEnv -&gt; [Var] -&gt; (SimpleOptEnv, [Var])
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-var">subst_opt_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864718"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864717"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-type">subst_opt_bndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InVar"><span class="hs-identifier hs-type">InVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-576"></span><span id="subst_opt_bndr"><span class="annot"><span class="annottext">subst_opt_bndr :: SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_bndr"><span class="hs-identifier hs-var hs-var">subst_opt_bndr</span></a></span></span><span> </span><span id="local-6989586621680864716"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864716"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864715"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span></span><span>
</span><span id="line-577"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864716"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864714"><span class="hs-identifier hs-var">subst_tv</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864713"><span class="hs-identifier hs-var">tv'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-578"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isCoVar"><span class="hs-identifier hs-var">isCoVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864716"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864712"><span class="hs-identifier hs-var">subst_cv</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864711"><span class="hs-identifier hs-var">cv'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-579"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_id_bndr"><span class="hs-identifier hs-var">subst_opt_id_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864716"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-580"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-581"></span><span>    </span><span id="local-6989586621680864709"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680864709"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864716"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-582"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864714"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864714"><span class="hs-identifier hs-var">subst_tv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864713"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864713"><span class="hs-identifier hs-var">tv'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; (Subst, Var)
</span><a href="GHC.Core.Subst.html#substTyVarBndr"><span class="hs-identifier hs-var">substTyVarBndr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864709"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-583"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680864712"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864712"><span class="hs-identifier hs-var">subst_cv</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864711"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864711"><span class="hs-identifier hs-var">cv'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; (Subst, Var)
</span><a href="GHC.Core.Subst.html#substCoVarBndr"><span class="hs-identifier hs-var">substCoVarBndr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864709"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864715"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-584"></span><span>
</span><span id="line-585"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#subst_opt_id_bndr"><span class="hs-identifier hs-type">subst_opt_id_bndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InId"><span class="hs-identifier hs-type">InId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutId"><span class="hs-identifier hs-type">OutId</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-586"></span><span class="hs-comment">-- Nuke all fragile IdInfo, unfolding, and RULES; it gets added back later by</span><span>
</span><span id="line-587"></span><span class="hs-comment">-- add_info.</span><span>
</span><span id="line-588"></span><span class="hs-comment">--</span><span>
</span><span id="line-589"></span><span class="hs-comment">-- Rather like SimplEnv.substIdBndr</span><span>
</span><span id="line-590"></span><span class="hs-comment">--</span><span>
</span><span id="line-591"></span><span class="hs-comment">-- It's important to zap fragile OccInfo (which GHC.Core.Subst.substIdBndr</span><span>
</span><span id="line-592"></span><span class="hs-comment">-- carefully does not do) because simplOptExpr invalidates it</span><span>
</span><span id="line-593"></span><span>
</span><span id="line-594"></span><span id="subst_opt_id_bndr"><span class="annot"><span class="annottext">subst_opt_id_bndr :: SimpleOptEnv -&gt; Var -&gt; (SimpleOptEnv, Var)
</span><a href="GHC.Core.SimpleOpt.html#subst_opt_id_bndr"><span class="hs-identifier hs-var hs-var">subst_opt_id_bndr</span></a></span></span><span> </span><span id="local-6989586621680864706"><span class="annot"><span class="annottext">env :: SimpleOptEnv
</span><a href="#local-6989586621680864706"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SOE"><span class="hs-identifier hs-type">SOE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864705"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864705"><span class="hs-identifier hs-var">subst</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_inl :: SimpleOptEnv -&gt; IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864704"><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680864704"><span class="hs-identifier hs-var">inl</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864703"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span></span><span>
</span><span id="line-595"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864706"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">soe_subst :: Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var">soe_subst</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864702"><span class="hs-identifier hs-var">new_subst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">soe_inl :: IdEnv SimpleClo
</span><a href="GHC.Core.SimpleOpt.html#soe_inl"><span class="hs-identifier hs-var">soe_inl</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680864701"><span class="hs-identifier hs-var">new_inl</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864700"><span class="hs-identifier hs-var">new_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-596"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-597"></span><span>    </span><span class="annot"><a href="GHC.Core.Subst.html#Subst"><span class="hs-identifier hs-type">Subst</span></a></span><span> </span><span id="local-6989586621680864698"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864698"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span id="local-6989586621680864697"><span class="annot"><span class="annottext">IdSubstEnv
</span><a href="#local-6989586621680864697"><span class="hs-identifier hs-var">id_subst</span></a></span></span><span> </span><span id="local-6989586621680864696"><span class="annot"><span class="annottext">TvSubstEnv
</span><a href="#local-6989586621680864696"><span class="hs-identifier hs-var">tv_subst</span></a></span></span><span> </span><span id="local-6989586621680864695"><span class="annot"><span class="annottext">CvSubstEnv
</span><a href="#local-6989586621680864695"><span class="hs-identifier hs-var">cv_subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864705"><span class="hs-identifier hs-var">subst</span></a></span><span>
</span><span id="line-598"></span><span>
</span><span id="line-599"></span><span>    </span><span id="local-6989586621680864694"><span class="annot"><span class="annottext">id1 :: Var
</span><a href="#local-6989586621680864694"><span class="hs-identifier hs-var hs-var">id1</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Var -&gt; Var
</span><a href="GHC.Types.Var.Env.html#uniqAway"><span class="hs-identifier hs-var">uniqAway</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864698"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span><span>
</span><span id="line-600"></span><span>    </span><span id="local-6989586621680864692"><span class="annot"><span class="annottext">id2 :: Var
</span><a href="#local-6989586621680864692"><span class="hs-identifier hs-var hs-var">id2</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Type) -&gt; Var -&gt; Var
</span><a href="GHC.Types.Var.html#updateIdTypeAndMult"><span class="hs-identifier hs-var">updateIdTypeAndMult</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Type -&gt; Type
</span><a href="GHC.Core.Subst.html#substTy"><span class="hs-identifier hs-var">substTy</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864705"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864694"><span class="hs-identifier hs-var">id1</span></a></span><span>
</span><span id="line-601"></span><span>    </span><span id="local-6989586621680864700"><span class="annot"><span class="annottext">new_id :: Var
</span><a href="#local-6989586621680864700"><span class="hs-identifier hs-var hs-var">new_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Var
</span><a href="GHC.Types.Id.html#zapFragileIdInfo"><span class="hs-identifier hs-var">zapFragileIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864692"><span class="hs-identifier hs-var">id2</span></a></span><span>
</span><span id="line-602"></span><span>             </span><span class="hs-comment">-- Zaps rules, unfolding, and fragile OccInfo</span><span>
</span><span id="line-603"></span><span>             </span><span class="hs-comment">-- The unfolding and rules will get added back later, by add_info</span><span>
</span><span id="line-604"></span><span>
</span><span id="line-605"></span><span>    </span><span id="local-6989586621680864689"><span class="annot"><span class="annottext">new_in_scope :: InScopeSet
</span><a href="#local-6989586621680864689"><span class="hs-identifier hs-var hs-var">new_in_scope</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864698"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Var -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#extendInScopeSet"><span class="hs-operator hs-var">`extendInScopeSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864700"><span class="hs-identifier hs-var">new_id</span></a></span><span>
</span><span id="line-606"></span><span>
</span><span id="line-607"></span><span>    </span><span id="local-6989586621680864685"><span class="annot"><span class="annottext">no_change :: Bool
</span><a href="#local-6989586621680864685"><span class="hs-identifier hs-var hs-var">no_change</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864700"><span class="hs-identifier hs-var">new_id</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Var -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span><span>
</span><span id="line-608"></span><span>
</span><span id="line-609"></span><span>        </span><span class="hs-comment">-- Extend the substitution if the unique has changed,</span><span>
</span><span id="line-610"></span><span>        </span><span class="hs-comment">-- See the notes with substTyVarBndr for the delSubstEnv</span><span>
</span><span id="line-611"></span><span>    </span><span id="local-6989586621680864684"><span class="annot"><span class="annottext">new_id_subst :: IdSubstEnv
</span><a href="#local-6989586621680864684"><span class="hs-identifier hs-var hs-var">new_id_subst</span></a></span></span><span>
</span><span id="line-612"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680864685"><span class="hs-identifier hs-var">no_change</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdSubstEnv -&gt; Var -&gt; IdSubstEnv
forall a. VarEnv a -&gt; Var -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#delVarEnv"><span class="hs-identifier hs-var">delVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdSubstEnv
</span><a href="#local-6989586621680864697"><span class="hs-identifier hs-var">id_subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span><span>
</span><span id="line-613"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdSubstEnv -&gt; Var -&gt; Expr Var -&gt; IdSubstEnv
forall a. VarEnv a -&gt; Var -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnv"><span class="hs-identifier hs-var">extendVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdSubstEnv
</span><a href="#local-6989586621680864697"><span class="hs-identifier hs-var">id_subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var
forall b. Var -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864700"><span class="hs-identifier hs-var">new_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-614"></span><span>
</span><span id="line-615"></span><span>    </span><span id="local-6989586621680864702"><span class="annot"><span class="annottext">new_subst :: Subst
</span><a href="#local-6989586621680864702"><span class="hs-identifier hs-var hs-var">new_subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; IdSubstEnv -&gt; TvSubstEnv -&gt; CvSubstEnv -&gt; Subst
</span><a href="GHC.Core.Subst.html#Subst"><span class="hs-identifier hs-var">Subst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864689"><span class="hs-identifier hs-var">new_in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">IdSubstEnv
</span><a href="#local-6989586621680864684"><span class="hs-identifier hs-var">new_id_subst</span></a></span><span> </span><span class="annot"><span class="annottext">TvSubstEnv
</span><a href="#local-6989586621680864696"><span class="hs-identifier hs-var">tv_subst</span></a></span><span> </span><span class="annot"><span class="annottext">CvSubstEnv
</span><a href="#local-6989586621680864695"><span class="hs-identifier hs-var">cv_subst</span></a></span><span>
</span><span id="line-616"></span><span>    </span><span id="local-6989586621680864701"><span class="annot"><span class="annottext">new_inl :: IdEnv SimpleClo
</span><a href="#local-6989586621680864701"><span class="hs-identifier hs-var hs-var">new_inl</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo -&gt; Var -&gt; IdEnv SimpleClo
forall a. VarEnv a -&gt; Var -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#delVarEnv"><span class="hs-identifier hs-var">delVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">IdEnv SimpleClo
</span><a href="#local-6989586621680864704"><span class="hs-identifier hs-var">inl</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864703"><span class="hs-identifier hs-var">old_id</span></a></span><span>
</span><span id="line-617"></span><span>
</span><span id="line-618"></span><span class="hs-comment">----------------------</span><span>
</span><span id="line-619"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#add_info"><span class="hs-identifier hs-type">add_info</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#SimpleOptEnv"><span class="hs-identifier hs-type">SimpleOptEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#InVar"><span class="hs-identifier hs-type">InVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#OutExpr"><span class="hs-identifier hs-type">OutExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#OutVar"><span class="hs-identifier hs-type">OutVar</span></a></span><span>
</span><span id="line-620"></span><span id="add_info"><span class="annot"><span class="annottext">add_info :: SimpleOptEnv -&gt; Var -&gt; TopLevelFlag -&gt; Expr Var -&gt; Var -&gt; Var
</span><a href="GHC.Core.SimpleOpt.html#add_info"><span class="hs-identifier hs-var hs-var">add_info</span></a></span></span><span> </span><span id="local-6989586621680864682"><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864682"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864681"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864681"><span class="hs-identifier hs-var">old_bndr</span></a></span></span><span> </span><span id="local-6989586621680864680"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864680"><span class="hs-identifier hs-var">top_level</span></a></span></span><span> </span><span id="local-6989586621680864679"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864679"><span class="hs-identifier hs-var">new_rhs</span></a></span></span><span> </span><span id="local-6989586621680864678"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864678"><span class="hs-identifier hs-var">new_bndr</span></a></span></span><span>
</span><span id="line-621"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864681"><span class="hs-identifier hs-var">old_bndr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864678"><span class="hs-identifier hs-var">new_bndr</span></a></span><span>
</span><span id="line-622"></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; IdInfo -&gt; Var
</span><a href="GHC.Types.Id.html#lazySetIdInfo"><span class="hs-identifier hs-var">lazySetIdInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864678"><span class="hs-identifier hs-var">new_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">IdInfo
</span><a href="#local-6989586621680864676"><span class="hs-identifier hs-var">new_info</span></a></span><span>
</span><span id="line-623"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-624"></span><span>   </span><span id="local-6989586621680864675"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680864675"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; Subst
</span><a href="GHC.Core.SimpleOpt.html#soe_subst"><span class="hs-identifier hs-var hs-var">soe_subst</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864682"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-625"></span><span>   </span><span id="local-6989586621680864674"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621680864674"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv -&gt; DynFlags
</span><a href="GHC.Core.SimpleOpt.html#soe_dflags"><span class="hs-identifier hs-var hs-var">soe_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SimpleOptEnv
</span><a href="#local-6989586621680864682"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-626"></span><span>   </span><span id="local-6989586621680864672"><span class="annot"><span class="annottext">old_info :: IdInfo
</span><a href="#local-6989586621680864672"><span class="hs-identifier hs-var hs-var">old_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Var -&gt; IdInfo
Var -&gt; IdInfo
</span><a href="GHC.Types.Var.html#idInfo"><span class="hs-identifier hs-var">idInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864681"><span class="hs-identifier hs-var">old_bndr</span></a></span><span>
</span><span id="line-627"></span><span>
</span><span id="line-628"></span><span>   </span><span class="hs-comment">-- Add back in the rules and unfolding which were</span><span>
</span><span id="line-629"></span><span>   </span><span class="hs-comment">-- removed by zapFragileIdInfo in subst_opt_id_bndr.</span><span>
</span><span id="line-630"></span><span>   </span><span class="hs-comment">--</span><span>
</span><span id="line-631"></span><span>   </span><span class="hs-comment">-- See Note [The Let-Unfoldings Invariant]</span><span>
</span><span id="line-632"></span><span>   </span><span id="local-6989586621680864676"><span class="annot"><span class="annottext">new_info :: IdInfo
</span><a href="#local-6989586621680864676"><span class="hs-identifier hs-var hs-var">new_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Var -&gt; IdInfo
Var -&gt; IdInfo
</span><a href="GHC.Types.Var.html#idInfo"><span class="hs-identifier hs-var">idInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864678"><span class="hs-identifier hs-var">new_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">IdInfo -&gt; RuleInfo -&gt; IdInfo
</span><a href="GHC.Types.Id.Info.html#setRuleInfo"><span class="hs-operator hs-var">`setRuleInfo`</span></a></span><span>      </span><span class="annot"><span class="annottext">RuleInfo
</span><a href="#local-6989586621680864669"><span class="hs-identifier hs-var">new_rules</span></a></span><span>
</span><span id="line-633"></span><span>                              </span><span class="annot"><span class="annottext">IdInfo -&gt; Unfolding -&gt; IdInfo
</span><a href="GHC.Types.Id.Info.html#setUnfoldingInfo"><span class="hs-operator hs-var">`setUnfoldingInfo`</span></a></span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864668"><span class="hs-identifier hs-var">new_unfolding</span></a></span><span>
</span><span id="line-634"></span><span>
</span><span id="line-635"></span><span>   </span><span id="local-6989586621680864667"><span class="annot"><span class="annottext">old_rules :: RuleInfo
</span><a href="#local-6989586621680864667"><span class="hs-identifier hs-var hs-var">old_rules</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdInfo -&gt; RuleInfo
</span><a href="GHC.Types.Id.Info.html#ruleInfo"><span class="hs-identifier hs-var hs-var">ruleInfo</span></a></span><span> </span><span class="annot"><span class="annottext">IdInfo
</span><a href="#local-6989586621680864672"><span class="hs-identifier hs-var">old_info</span></a></span><span>
</span><span id="line-636"></span><span>   </span><span id="local-6989586621680864669"><span class="annot"><span class="annottext">new_rules :: RuleInfo
</span><a href="#local-6989586621680864669"><span class="hs-identifier hs-var hs-var">new_rules</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; RuleInfo -&gt; RuleInfo
</span><a href="GHC.Core.Subst.html#substSpec"><span class="hs-identifier hs-var">substSpec</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864675"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864678"><span class="hs-identifier hs-var">new_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">RuleInfo
</span><a href="#local-6989586621680864667"><span class="hs-identifier hs-var">old_rules</span></a></span><span>
</span><span id="line-637"></span><span>
</span><span id="line-638"></span><span>   </span><span id="local-6989586621680864664"><span class="annot"><span class="annottext">old_unfolding :: Unfolding
</span><a href="#local-6989586621680864664"><span class="hs-identifier hs-var hs-var">old_unfolding</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdInfo -&gt; Unfolding
</span><a href="GHC.Types.Id.Info.html#unfoldingInfo"><span class="hs-identifier hs-var hs-var">unfoldingInfo</span></a></span><span> </span><span class="annot"><span class="annottext">IdInfo
</span><a href="#local-6989586621680864672"><span class="hs-identifier hs-var">old_info</span></a></span><span>
</span><span id="line-639"></span><span>   </span><span id="local-6989586621680864668"><span class="annot"><span class="annottext">new_unfolding :: Unfolding
</span><a href="#local-6989586621680864668"><span class="hs-identifier hs-var hs-var">new_unfolding</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Bool
</span><a href="GHC.Core.html#isStableUnfolding"><span class="hs-identifier hs-var">isStableUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864664"><span class="hs-identifier hs-var">old_unfolding</span></a></span><span>
</span><span id="line-640"></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Unfolding -&gt; Unfolding
</span><a href="GHC.Core.Subst.html#substUnfolding"><span class="hs-identifier hs-var">substUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864675"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864664"><span class="hs-identifier hs-var">old_unfolding</span></a></span><span>
</span><span id="line-641"></span><span>                 </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-642"></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864662"><span class="hs-identifier hs-var">unfolding_from_rhs</span></a></span><span>
</span><span id="line-643"></span><span>
</span><span id="line-644"></span><span>   </span><span id="local-6989586621680864662"><span class="annot"><span class="annottext">unfolding_from_rhs :: Unfolding
</span><a href="#local-6989586621680864662"><span class="hs-identifier hs-var hs-var">unfolding_from_rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; UnfoldingSource -&gt; Bool -&gt; Bool -&gt; Expr Var -&gt; Unfolding
</span><a href="GHC.Core.Unfold.html#mkUnfolding"><span class="hs-identifier hs-var">mkUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680864674"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">UnfoldingSource
</span><a href="GHC.Core.html#InlineRhs"><span class="hs-identifier hs-var">InlineRhs</span></a></span><span>
</span><span id="line-645"></span><span>                                    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TopLevelFlag -&gt; Bool
</span><a href="GHC.Types.Basic.html#isTopLevel"><span class="hs-identifier hs-var">isTopLevel</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621680864680"><span class="hs-identifier hs-var">top_level</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span>                                    </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-comment">-- may be bottom or not</span><span>
</span><span id="line-647"></span><span>                                    </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864679"><span class="hs-identifier hs-var">new_rhs</span></a></span><span>
</span><span id="line-648"></span><span>
</span><span id="line-649"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#simpleUnfoldingFun"><span class="hs-identifier hs-type">simpleUnfoldingFun</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#IdUnfoldingFun"><span class="hs-identifier hs-type">IdUnfoldingFun</span></a></span><span>
</span><span id="line-650"></span><span id="simpleUnfoldingFun"><span class="annot"><span class="annottext">simpleUnfoldingFun :: IdUnfoldingFun
</span><a href="GHC.Core.SimpleOpt.html#simpleUnfoldingFun"><span class="hs-identifier hs-var hs-var">simpleUnfoldingFun</span></a></span></span><span> </span><span id="local-6989586621680864659"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864659"><span class="hs-identifier hs-var">id</span></a></span></span><span>
</span><span id="line-651"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Activation -&gt; Bool
</span><a href="GHC.Types.Basic.html#isAlwaysActive"><span class="hs-identifier hs-var">isAlwaysActive</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Activation
</span><a href="GHC.Types.Id.html#idInlineActivation"><span class="hs-identifier hs-var">idInlineActivation</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864659"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Types.Id.html#idUnfolding"><span class="hs-identifier hs-var">idUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864659"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-652"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="GHC.Core.html#noUnfolding"><span class="hs-identifier hs-var">noUnfolding</span></a></span><span>
</span><span id="line-653"></span><span>
</span><span id="line-654"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#wrapLet"><span class="hs-identifier hs-type">wrapLet</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-655"></span><span id="wrapLet"><span class="annot"><span class="annottext">wrapLet :: Maybe (Var, Expr Var) -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#wrapLet"><span class="hs-identifier hs-var hs-var">wrapLet</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>      </span><span id="local-6989586621680864656"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864656"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864656"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-656"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#wrapLet"><span class="hs-identifier hs-var">wrapLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864655"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864655"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864654"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864654"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864653"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864653"><span class="hs-identifier hs-var">body</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; Expr Var -&gt; Expr Var
forall b. Bind b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Let"><span class="hs-identifier hs-var">Let</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; InBind
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864655"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864654"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864653"><span class="hs-identifier hs-var">body</span></a></span><span>
</span><span id="line-657"></span><span>
</span><span id="line-658"></span><span class="hs-comment">{-
Note [Inline prag in simplOpt]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If there's an INLINE/NOINLINE pragma that restricts the phase in
which the binder can be inlined, we don't inline here; after all,
we don't know what phase we're in.  Here's an example

  foo :: Int -&gt; Int -&gt; Int
  {-# INLINE foo #-}
  foo m n = inner m
     where
       {-# INLINE [1] inner #-}
       inner m = m+n

  bar :: Int -&gt; Int
  bar n = foo n 1

When inlining 'foo' in 'bar' we want the let-binding for 'inner'
to remain visible until Phase 1

Note [Unfold compulsory unfoldings in LHSs]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When the user writes `RULES map coerce = coerce` as a rule, the rule
will only ever match if simpleOptExpr replaces coerce by its unfolding
on the LHS, because that is the core that the rule matching engine
will find. So do that for everything that has a compulsory
unfolding. Also see Note [Desugaring coerce as cast] in GHC.HsToCore.

However, we don't want to inline 'seq', which happens to also have a
compulsory unfolding, so we only do this unfolding only for things
that are always-active.  See Note [User-defined RULES for seq] in GHC.Types.Id.Make.

Note [Getting the map/coerce RULE to work]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We wish to allow the &quot;map/coerce&quot; RULE to fire:

  {-# RULES &quot;map/coerce&quot; map coerce = coerce #-}

The naive core produced for this is

  forall a b (dict :: Coercible * a b).
    map @a @b (coerce @a @b @dict) = coerce @[a] @[b] @dict'

  where dict' :: Coercible [a] [b]
        dict' = ...

This matches literal uses of `map coerce` in code, but that's not what we
want. We want it to match, say, `map MkAge` (where newtype Age = MkAge Int)
too. Some of this is addressed by compulsorily unfolding coerce on the LHS,
yielding

  forall a b (dict :: Coercible * a b).
    map @a @b (\(x :: a) -&gt; case dict of
      MkCoercible (co :: a ~R# b) -&gt; x |&gt; co) = ...

Getting better. But this isn't exactly what gets produced. This is because
Coercible essentially has ~R# as a superclass, and superclasses get eagerly
extracted during solving. So we get this:

  forall a b (dict :: Coercible * a b).
    case Coercible_SCSel @* @a @b dict of
      _ [Dead] -&gt; map @a @b (\(x :: a) -&gt; case dict of
                               MkCoercible (co :: a ~R# b) -&gt; x |&gt; co) = ...

Unfortunately, this still abstracts over a Coercible dictionary. We really
want it to abstract over the ~R# evidence. So, we have Desugar.unfold_coerce,
which transforms the above to (see also Note [Desugaring coerce as cast] in
Desugar)

  forall a b (co :: a ~R# b).
    let dict = MkCoercible @* @a @b co in
    case Coercible_SCSel @* @a @b dict of
      _ [Dead] -&gt; map @a @b (\(x :: a) -&gt; case dict of
         MkCoercible (co :: a ~R# b) -&gt; x |&gt; co) = let dict = ... in ...

Now, we need simpleOptExpr to fix this up. It does so by taking three
separate actions:
  1. Inline certain non-recursive bindings. The choice whether to inline
     is made in simple_bind_pair. Note the rather specific check for
     MkCoercible in there.

  2. Stripping case expressions like the Coercible_SCSel one.
     See the `Case` case of simple_opt_expr's `go` function.

  3. Look for case expressions that unpack something that was
     just packed and inline them. This is also done in simple_opt_expr's
     `go` function.

This is all a fair amount of special-purpose hackery, but it's for
a good cause. And it won't hurt other RULES and such that it comes across.


************************************************************************
*                                                                      *
                Join points
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-756"></span><span>
</span><span id="line-757"></span><span class="hs-comment">-- | Returns Just (bndr,rhs) if the binding is a join point:</span><span>
</span><span id="line-758"></span><span class="hs-comment">-- If it's a JoinId, just return it</span><span>
</span><span id="line-759"></span><span class="hs-comment">-- If it's not yet a JoinId but is always tail-called,</span><span>
</span><span id="line-760"></span><span class="hs-comment">--    make it into a JoinId and return it.</span><span>
</span><span id="line-761"></span><span class="hs-comment">-- In the latter case, eta-expand the RHS if necessary, to make the</span><span>
</span><span id="line-762"></span><span class="hs-comment">-- lambdas explicit, as is required for join points</span><span>
</span><span id="line-763"></span><span class="hs-comment">--</span><span>
</span><span id="line-764"></span><span class="hs-comment">-- Precondition: the InBndr has been occurrence-analysed,</span><span>
</span><span id="line-765"></span><span class="hs-comment">--               so its OccInfo is valid</span><span>
</span><span id="line-766"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#joinPointBinding_maybe"><span class="hs-identifier hs-type">joinPointBinding_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#InBndr"><span class="hs-identifier hs-type">InBndr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#InBndr"><span class="hs-identifier hs-type">InBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-767"></span><span id="joinPointBinding_maybe"><span class="annot"><span class="annottext">joinPointBinding_maybe :: Var -&gt; Expr Var -&gt; Maybe (Var, Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#joinPointBinding_maybe"><span class="hs-identifier hs-var hs-var">joinPointBinding_maybe</span></a></span></span><span> </span><span id="local-6989586621680864651"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680864650"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864650"><span class="hs-identifier hs-var">rhs</span></a></span></span><span>
</span><span id="line-768"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isId"><span class="hs-identifier hs-var">isId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-769"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Id.html#isJoinId"><span class="hs-identifier hs-var">isJoinId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-772"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864650"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-773"></span><span>
</span><span id="line-774"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#AlwaysTailCalled"><span class="hs-identifier hs-type">AlwaysTailCalled</span></a></span><span> </span><span id="local-6989586621680864646"><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864646"><span class="hs-identifier hs-var">join_arity</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OccInfo -&gt; TailCallInfo
</span><a href="GHC.Types.Basic.html#tailCallInfo"><span class="hs-identifier hs-var">tailCallInfo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; OccInfo
</span><a href="GHC.Types.Id.html#idOccInfo"><span class="hs-identifier hs-var">idOccInfo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-775"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864644"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864644"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864643"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864643"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; Expr Var -&gt; ([Var], Expr Var)
</span><a href="GHC.Core.Opt.Arity.html#etaExpandToJoinPoint"><span class="hs-identifier hs-var">etaExpandToJoinPoint</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864646"><span class="hs-identifier hs-var">join_arity</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864650"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-776"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864642"><span class="annot"><span class="annottext">str_sig :: StrictSig
</span><a href="#local-6989586621680864642"><span class="hs-identifier hs-var hs-var">str_sig</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; StrictSig
</span><a href="GHC.Types.Id.html#idStrictness"><span class="hs-identifier hs-var">idStrictness</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-777"></span><span>        </span><span id="local-6989586621680864640"><span class="annot"><span class="annottext">str_arity :: BranchCount
</span><a href="#local-6989586621680864640"><span class="hs-identifier hs-var hs-var">str_arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var -&gt; Bool) -&gt; [Var] -&gt; BranchCount
forall a. (a -&gt; Bool) -&gt; [a] -&gt; BranchCount
</span><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier hs-var">count</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isId"><span class="hs-identifier hs-var">isId</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864644"><span class="hs-identifier hs-var">bndrs</span></a></span><span>  </span><span class="hs-comment">-- Strictness demands are for Ids only</span><span>
</span><span id="line-778"></span><span>        </span><span id="local-6989586621680864638"><span class="annot"><span class="annottext">join_bndr :: Var
</span><a href="#local-6989586621680864638"><span class="hs-identifier hs-var hs-var">join_bndr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864651"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; BranchCount -&gt; Var
</span><a href="GHC.Types.Id.html#asJoinId"><span class="hs-operator hs-var">`asJoinId`</span></a></span><span>        </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864646"><span class="hs-identifier hs-var">join_arity</span></a></span><span>
</span><span id="line-779"></span><span>                         </span><span class="annot"><span class="annottext">Var -&gt; StrictSig -&gt; Var
</span><a href="GHC.Types.Id.html#setIdStrictness"><span class="hs-operator hs-var">`setIdStrictness`</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; StrictSig -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#etaConvertStrictSig"><span class="hs-identifier hs-var">etaConvertStrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864640"><span class="hs-identifier hs-var">str_arity</span></a></span><span> </span><span class="annot"><span class="annottext">StrictSig
</span><a href="#local-6989586621680864642"><span class="hs-identifier hs-var">str_sig</span></a></span><span>
</span><span id="line-780"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864638"><span class="hs-identifier hs-var">join_bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; Expr Var
forall b. [b] -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#mkLams"><span class="hs-identifier hs-var">mkLams</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864644"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864643"><span class="hs-identifier hs-var">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-781"></span><span>
</span><span id="line-782"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-783"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-784"></span><span>
</span><span id="line-785"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#joinPointBindings_maybe"><span class="hs-identifier hs-type">joinPointBindings_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#InBndr"><span class="hs-identifier hs-type">InBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#InBndr"><span class="hs-identifier hs-type">InBndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#InExpr"><span class="hs-identifier hs-type">InExpr</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-786"></span><span id="joinPointBindings_maybe"><span class="annot"><span class="annottext">joinPointBindings_maybe :: [(Var, Expr Var)] -&gt; Maybe [(Var, Expr Var)]
</span><a href="GHC.Core.SimpleOpt.html#joinPointBindings_maybe"><span class="hs-identifier hs-var hs-var">joinPointBindings_maybe</span></a></span></span><span> </span><span id="local-6989586621680864635"><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864635"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span>
</span><span id="line-787"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((Var, Expr Var) -&gt; Maybe (Var, Expr Var))
-&gt; [(Var, Expr Var)] -&gt; Maybe [(Var, Expr Var)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Var -&gt; Expr Var -&gt; Maybe (Var, Expr Var))
-&gt; (Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="../../base/src/Data.Tuple.html#uncurry"><span class="hs-identifier hs-var">uncurry</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; Maybe (Var, Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#joinPointBinding_maybe"><span class="hs-identifier hs-var">joinPointBinding_maybe</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Var, Expr Var)]
</span><a href="#local-6989586621680864635"><span class="hs-identifier hs-var">bndrs</span></a></span><span>
</span><span id="line-788"></span><span>
</span><span id="line-789"></span><span>
</span><span id="line-790"></span><span class="hs-comment">{- Note [Strictness and join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have

   let f = \x.  if x&gt;200 then e1 else e1

and we know that f is strict in x.  Then if we subsequently
discover that f is an arity-2 join point, we'll eta-expand it to

   let f = \x y.  if x&gt;200 then e1 else e1

and now it's only strict if applied to two arguments.  So we should
adjust the strictness info.

A more common case is when

   f = \x. error &quot;..&quot;

and again its arity increases (#15517)
-}</span><span>
</span><span id="line-810"></span><span>
</span><span id="line-811"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
         exprIsConApp_maybe
*                                                                      *
************************************************************************

Note [exprIsConApp_maybe]
~~~~~~~~~~~~~~~~~~~~~~~~~
exprIsConApp_maybe is a very important function.  There are two principal
uses:
  * case e of { .... }
  * cls_op e, where cls_op is a class operation

In both cases you want to know if e is of form (C e1..en) where C is
a data constructor.

However e might not *look* as if


Note [exprIsConApp_maybe on literal strings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
See #9400 and #13317.

Conceptually, a string literal &quot;abc&quot; is just ('a':'b':'c':[]), but in Core
they are represented as unpackCString# &quot;abc&quot;# by GHC.Core.Make.mkStringExprFS, or
unpackCStringUtf8# when the literal contains multi-byte UTF8 characters.

For optimizations we want to be able to treat it as a list, so they can be
decomposed when used in a case-statement. exprIsConApp_maybe detects those
calls to unpackCString# and returns:

Just (':', [Char], ['a', unpackCString# &quot;bc&quot;]).

We need to be careful about UTF8 strings here. &quot;&quot;# contains an encoded ByteString, so
we call utf8UnconsByteString to correctly deal with the encoding and splitting.

We must also be careful about
   lvl = &quot;foo&quot;#
   ...(unpackCString# lvl)...
to ensure that we see through the let-binding for 'lvl'.  Hence the
(exprIsLiteral_maybe .. arg) in the guard before the call to
dealWithStringLiteral.

The tests for this function are in T9400.

Note [Push coercions in exprIsConApp_maybe]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In #13025 I found a case where we had
    op (df @t1 @t2)     -- op is a ClassOp
where
    df = (/\a b. K e1 e2) |&gt; g

To get this to come out we need to simplify on the fly
   ((/\a b. K e1 e2) |&gt; g) @t1 @t2

Hence the use of pushCoArgs.

Note [exprIsConApp_maybe on data constructors with wrappers]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Problem:
- some data constructors have wrappers
- these wrappers inline late (see MkId Note [Activation for data constructor wrappers])
- but we still want case-of-known-constructor to fire early.

Example:
   data T = MkT !Int
   $WMkT n = case n of n' -&gt; MkT n'   -- Wrapper for MkT
   foo x = case $WMkT e of MkT y -&gt; blah

Here we want the case-of-known-constructor transformation to fire, giving
   foo x = case e of x' -&gt; let y = x' in blah

Here's how exprIsConApp_maybe achieves this:

0.  Start with scrutinee = $WMkT e

1.  Inline $WMkT on-the-fly.  That's why data-constructor wrappers are marked
    as expandable. (See GHC.Core.Utils.isExpandableApp.) Now we have
      scrutinee = (\n. case n of n' -&gt; MkT n') e

2.  Beta-reduce the application, generating a floated 'let'.
    See Note [beta-reduction in exprIsConApp_maybe] below.  Now we have
      scrutinee = case n of n' -&gt; MkT n'
      with floats {Let n = e}

3.  Float the &quot;case x of x' -&gt;&quot; binding out.  Now we have
      scrutinee = MkT n'
      with floats {Let n = e; case n of n' -&gt;}

And now we have a known-constructor MkT that we can return.

Notice that both (2) and (3) require exprIsConApp_maybe to gather and return
a bunch of floats, both let and case bindings.

Note that this strategy introduces some subtle scenarios where a data-con
wrapper can be replaced by a data-con worker earlier than we&#8217;d like, see
Note [exprIsConApp_maybe for data-con wrappers: tricky corner].

Note [beta-reduction in exprIsConApp_maybe]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The unfolding a definition (_e.g._ a let-bound variable or a datacon wrapper) is
typically a function. For instance, take the wrapper for MkT in Note
[exprIsConApp_maybe on data constructors with wrappers]:

    $WMkT n = case n of { n' -&gt; T n' }

If `exprIsConApp_maybe` is trying to analyse `$MkT arg`, upon unfolding of $MkT,
it will see

   (\n -&gt; case n of { n' -&gt; T n' }) arg

In order to go progress, `exprIsConApp_maybe` must perform a beta-reduction.

We don't want to blindly substitute `arg` in the body of the function, because
it duplicates work. We can (and, in fact, used to) substitute `arg` in the body,
but only when `arg` is a variable (or something equally work-free).

But, because of Note [exprIsConApp_maybe on data constructors with wrappers],
'exprIsConApp_maybe' now returns floats. So, instead, we can beta-reduce
_always_:

    (\x -&gt; body) arg

Is transformed into

   let x = arg in body

Which, effectively, means emitting a float `let x = arg` and recursively
analysing the body.

For newtypes, this strategy requires that their wrappers have compulsory unfoldings.
Suppose we have
   newtype T a b where
     MkT :: a -&gt; T b a   -- Note args swapped

This defines a worker function MkT, a wrapper function $WMkT, and an axT:
   $WMkT :: forall a b. a -&gt; T b a
   $WMkT = /\b a. \(x:a). MkT a b x    -- A real binding

   MkT :: forall a b. a -&gt; T a b
   MkT = /\a b. \(x:a). x |&gt; (ax a b)  -- A compulsory unfolding

   axiom axT :: a ~R# T a b

Now we are optimising
   case $WMkT (I# 3) |&gt; sym axT of I# y -&gt; ...
we clearly want to simplify this. If $WMkT did not have a compulsory
unfolding, we would end up with
   let a = I#3 in case a of I# y -&gt; ...
because in general, we do this on-the-fly beta-reduction
   (\x. e) blah  --&gt;  let x = blah in e
and then float the let.  (Substitution would risk duplicating 'blah'.)

But if the case-of-known-constructor doesn't actually fire (i.e.
exprIsConApp_maybe does not return Just) then nothing happens, and nothing
will happen the next time either.

See test T16254, which checks the behavior of newtypes.

Note [Don't float join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exprIsConApp_maybe should succeed on
   let v = e in Just v
returning [x=e] as one of the [FloatBind].  But it must
NOT succeed on
   join j x = rhs in Just v
because join-points can't be gaily floated.  Consider
   case (join j x = rhs in Just) of
     K p q -&gt; blah
We absolutely must not &quot;simplify&quot; this to
   join j x = rhs
   in blah
because j's return type is (Maybe t), quite different to blah's.

You might think this could never happen, because j can't be
tail-called in the body if the body returns a constructor.  But
in !3113 we had a /dead/ join point (which is not illegal),
and its return type was wonky.

The simple thing is not to float a join point.  The next iteration
of the simplifier will sort everything out.  And it there is
a join point, the chances are that the body is not a constructor
application, so failing faster is good.

Note [exprIsConApp_maybe for data-con wrappers: tricky corner]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Generally speaking

  * exprIsConApp_maybe honours the inline phase; that is, it does not look
    inside the unfolding for an Id unless its unfolding is active in this phase.
    That phase-sensitivity is expressed in the InScopeEnv (specifically, the
    IdUnfoldingFun component of the InScopeEnv) passed to exprIsConApp_maybe.

  * Data-constructor wrappers are active only in phase 0 (the last phase);
    see Note [Activation for data constructor wrappers] in GHC.Types.Id.Make.

On the face of it that means that exprIsConApp_maybe won't look inside data
constructor wrappers until phase 0. But that seems pretty Bad. So we cheat.
For data con wrappers we unconditionally look inside its unfolding, regardless
of phase, so that we get case-of-known-constructor to fire in every phase.

Perhaps unsurprisingly, this cheating can backfire. An example:

    data T = C !A B
    foo p q = let x = C e1 e2 in seq x $ f x
    {-# RULE &quot;wurble&quot; f (C a b) = b #-}

In Core, the RHS of foo is

    let x = $WC e1 e2 in case x of y { C _ _ -&gt; f x }

and after doing a binder swap and inlining x, we have:

    case $WC e1 e2 of y { C _ _ -&gt; f y }

Case-of-known-constructor fires, but now we have to reconstruct a binding for
`y` (which was dead before the binder swap) on the RHS of the case alternative.
Naturally, we&#8217;ll use the worker:

    case e1 of a { DEFAULT -&gt; let y = C a e2 in f y }

and after inlining `y`, we have:

    case e1 of a { DEFAULT -&gt; f (C a e2) }

Now we might hope the &quot;wurble&quot; rule would fire, but alas, it will not: we have
replaced $WC with C, but the (desugared) rule matches on $WC! We weren&#8217;t
supposed to inline $WC yet for precisely that reason (see Note [Activation for
data constructor wrappers]), but our cheating in exprIsConApp_maybe came back to
bite us.

This is rather unfortunate, especially since this can happen inside stable
unfoldings as well as ordinary code (which really happened, see !3041). But
there is no obvious solution except to delay case-of-known-constructor on
data-con wrappers, and that cure would be worse than the disease.

This Note exists solely to document the problem.
-}</span><span>
</span><span id="line-1049"></span><span>
</span><span id="line-1050"></span><span class="hs-keyword">data</span><span> </span><span id="ConCont"><span class="annot"><a href="GHC.Core.SimpleOpt.html#ConCont"><span class="hs-identifier hs-var">ConCont</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="CC"><span class="annot"><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-1051"></span><span>                  </span><span class="hs-comment">-- Substitution already applied</span><span>
</span><span id="line-1052"></span><span>
</span><span id="line-1053"></span><span class="hs-comment">-- | Returns @Just ([b1..bp], dc, [t1..tk], [x1..xn])@ if the argument</span><span>
</span><span id="line-1054"></span><span class="hs-comment">-- expression is a *saturated* constructor application of the form @let b1 in</span><span>
</span><span id="line-1055"></span><span class="hs-comment">-- .. let bp in dc t1..tk x1 .. xn@, where t1..tk are the</span><span>
</span><span id="line-1056"></span><span class="hs-comment">-- *universally-quantified* type args of 'dc'. Floats can also be (and most</span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- likely are) single-alternative case expressions. Why does</span><span>
</span><span id="line-1058"></span><span class="hs-comment">-- 'exprIsConApp_maybe' return floats? We may have to look through lets and</span><span>
</span><span id="line-1059"></span><span class="hs-comment">-- cases to detect that we are in the presence of a data constructor wrapper. In</span><span>
</span><span id="line-1060"></span><span class="hs-comment">-- this case, we need to return the lets and cases that we traversed. See Note</span><span>
</span><span id="line-1061"></span><span class="hs-comment">-- [exprIsConApp_maybe on data constructors with wrappers]. Data constructor wrappers</span><span>
</span><span id="line-1062"></span><span class="hs-comment">-- are unfolded late, but we really want to trigger case-of-known-constructor as</span><span>
</span><span id="line-1063"></span><span class="hs-comment">-- early as possible. See also Note [Activation for data constructor wrappers]</span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- in &quot;GHC.Types.Id.Make&quot;.</span><span>
</span><span id="line-1065"></span><span class="hs-comment">--</span><span>
</span><span id="line-1066"></span><span class="hs-comment">-- We also return the incoming InScopeSet, augmented with</span><span>
</span><span id="line-1067"></span><span class="hs-comment">-- the binders from any [FloatBind] that we return</span><span>
</span><span id="line-1068"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsConApp_maybe"><span class="hs-identifier hs-type">exprIsConApp_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html#HasDebugCallStack"><span class="hs-identifier hs-type">HasDebugCallStack</span></a></span><span>
</span><span id="line-1069"></span><span>                   </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#InScopeEnv"><span class="hs-identifier hs-type">InScopeEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-1070"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier hs-type">FloatBind</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1071"></span><span id="exprIsConApp_maybe"><span class="annot"><span class="annottext">exprIsConApp_maybe :: HasDebugCallStack =&gt;
(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsConApp_maybe"><span class="hs-identifier hs-var hs-var">exprIsConApp_maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864619"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864619"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864618"><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864618"><span class="hs-identifier hs-var">id_unf</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864617"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864617"><span class="hs-identifier hs-var">expr</span></a></span></span><span>
</span><span id="line-1072"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Either InScopeSet Subst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864619"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864617"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkRepReflCo"><span class="hs-identifier hs-var">mkRepReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; Type
</span><a href="GHC.Core.Utils.html#exprType"><span class="hs-identifier hs-var">exprType</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864617"><span class="hs-identifier hs-var">expr</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1073"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1074"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="annot"><a href="GHC.Core.Subst.html#Subst"><span class="hs-identifier hs-type">Subst</span></a></span><span>
</span><span id="line-1075"></span><span>             </span><span class="hs-comment">-- Left in-scope  means &quot;empty substitution&quot;</span><span>
</span><span id="line-1076"></span><span>             </span><span class="hs-comment">-- Right subst    means &quot;apply this substitution to the CoreExpr&quot;</span><span>
</span><span id="line-1077"></span><span>             </span><span class="hs-comment">-- NB: in the call (go subst floats expr cont)</span><span>
</span><span id="line-1078"></span><span>             </span><span class="hs-comment">--     the substitution applies to 'expr', but /not/ to 'floats' or 'cont'</span><span>
</span><span id="line-1079"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier hs-type">FloatBind</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.SimpleOpt.html#ConCont"><span class="hs-identifier hs-type">ConCont</span></a></span><span>
</span><span id="line-1080"></span><span>             </span><span class="hs-comment">-- Notice that the floats here are in reverse order</span><span>
</span><span id="line-1081"></span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier hs-type">FloatBind</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1082"></span><span>    </span><span id="local-6989586621680864616"><span class="annot"><span class="annottext">go :: Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680864613"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864613"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864612"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864612"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680864611"><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864611"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680864610"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864610"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864609"><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864609"><span class="hs-identifier hs-var">cont</span></a></span></span><span>
</span><span id="line-1083"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Tickish Var -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishIsCode"><span class="hs-identifier hs-var">tickishIsCode</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864611"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864613"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864612"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864610"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864609"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1084"></span><span>
</span><span id="line-1085"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864607"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864607"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864606"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864606"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864605"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864605"><span class="hs-identifier hs-var">expr</span></a></span></span><span> </span><span id="local-6989586621680864604"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864604"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-type">CC</span></a></span><span> </span><span id="local-6989586621680864603"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864603"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680864602"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864602"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1086"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864601"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864601"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864600"><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864600"><span class="hs-identifier hs-var">m_co1'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; [Expr Var] -&gt; Maybe ([Expr Var], MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoArgs"><span class="hs-identifier hs-var">pushCoArgs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; CoercionR -&gt; CoercionR
forall {a}. Either a Subst -&gt; CoercionR -&gt; CoercionR
</span><a href="#local-6989586621680864598"><span class="hs-identifier hs-var">subst_co</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864607"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864604"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864603"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1087"></span><span>            </span><span class="hs-comment">-- See Note [Push coercions in exprIsConApp_maybe]</span><span>
</span><span id="line-1088"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864600"><span class="hs-identifier hs-var">m_co1'</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1089"></span><span>           </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-type">MCo</span></a></span><span> </span><span id="local-6989586621680864596"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864596"><span class="hs-identifier hs-var">co1'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864607"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864606"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864605"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864601"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864596"><span class="hs-identifier hs-var">co1'</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864602"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1090"></span><span>           </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864607"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864606"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864605"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864601"><span class="hs-identifier hs-var">args'</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864602"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1091"></span><span>
</span><span id="line-1092"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864594"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864594"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864593"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864593"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#App"><span class="hs-identifier hs-type">App</span></a></span><span> </span><span id="local-6989586621680864592"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864592"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621680864591"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864591"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-type">CC</span></a></span><span> </span><span id="local-6989586621680864590"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864590"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680864589"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864589"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1093"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864594"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864593"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864592"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Expr Var -&gt; Expr Var
forall {a}. Either a Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864588"><span class="hs-identifier hs-var">subst_expr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864594"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864591"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; [Expr Var] -&gt; [Expr Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864590"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864589"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1094"></span><span>
</span><span id="line-1095"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864587"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864587"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864586"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864586"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864585"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864585"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680864584"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864584"><span class="hs-identifier hs-var">body</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-type">CC</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864583"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864583"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680864582"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864582"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864581"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864581"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1096"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Bool
</span><a href="GHC.Core.Utils.html#exprIsTrivial"><span class="hs-identifier hs-var">exprIsTrivial</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864583"><span class="hs-identifier hs-var">arg</span></a></span><span>          </span><span class="hs-comment">-- Don't duplicate stuff!</span><span>
</span><span id="line-1097"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; Var -&gt; Expr Var -&gt; Either InScopeSet Subst
forall {a}.
Either InScopeSet Subst -&gt; Var -&gt; Expr Var -&gt; Either a Subst
</span><a href="#local-6989586621680864580"><span class="hs-identifier hs-var">extend</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864587"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864585"><span class="hs-identifier hs-var">bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864583"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864586"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864584"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864582"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864581"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1098"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1099"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864579"><span class="annot"><span class="annottext">Either a Subst
</span><a href="#local-6989586621680864579"><span class="hs-identifier hs-var">subst'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864578"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864578"><span class="hs-identifier hs-var">bndr'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
forall {a}. Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
</span><a href="#local-6989586621680864577"><span class="hs-identifier hs-var">subst_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864587"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864585"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-1100"></span><span>             </span><span id="local-6989586621680864576"><span class="annot"><span class="annottext">float :: FloatBind
</span><a href="#local-6989586621680864576"><span class="hs-identifier hs-var hs-var">float</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; FloatBind
</span><a href="GHC.Core.Make.html#FloatLet"><span class="hs-identifier hs-var">FloatLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; InBind
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864578"><span class="hs-identifier hs-var">bndr'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864583"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1101"></span><span>         </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
forall {a}. Either a Subst
</span><a href="#local-6989586621680864579"><span class="hs-identifier hs-var">subst'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FloatBind
</span><a href="#local-6989586621680864576"><span class="hs-identifier hs-var">float</span></a></span><span class="annot"><span class="annottext">FloatBind -&gt; [FloatBind] -&gt; [FloatBind]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864586"><span class="hs-identifier hs-var">floats</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864584"><span class="hs-identifier hs-var">body</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Expr Var] -&gt; CoercionR -&gt; ConCont
</span><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-var">CC</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864582"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864581"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1102"></span><span>
</span><span id="line-1103"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864574"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864574"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864573"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864573"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Let"><span class="hs-identifier hs-type">Let</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-type">NonRec</span></a></span><span> </span><span id="local-6989586621680864572"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864572"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span id="local-6989586621680864571"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864571"><span class="hs-identifier hs-var">rhs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864570"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864570"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864569"><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864569"><span class="hs-identifier hs-var">cont</span></a></span></span><span>
</span><span id="line-1104"></span><span>       </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Id.html#isJoinId"><span class="hs-identifier hs-var">isJoinId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864572"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1105"></span><span>         </span><span class="hs-comment">-- Crucial guard! See Note [Don't float join points]</span><span>
</span><span id="line-1106"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864568"><span class="annot"><span class="annottext">rhs' :: Expr Var
</span><a href="#local-6989586621680864568"><span class="hs-identifier hs-var hs-var">rhs'</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Expr Var -&gt; Expr Var
forall {a}. Either a Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864588"><span class="hs-identifier hs-var">subst_expr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864574"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864571"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-1107"></span><span>             </span><span class="hs-special">(</span><span id="local-6989586621680864567"><span class="annot"><span class="annottext">Either a Subst
</span><a href="#local-6989586621680864567"><span class="hs-identifier hs-var">subst'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864566"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864566"><span class="hs-identifier hs-var">bndr'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
forall {a}. Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
</span><a href="#local-6989586621680864577"><span class="hs-identifier hs-var">subst_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864574"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864572"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-1108"></span><span>             </span><span id="local-6989586621680864565"><span class="annot"><span class="annottext">float :: FloatBind
</span><a href="#local-6989586621680864565"><span class="hs-identifier hs-var hs-var">float</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InBind -&gt; FloatBind
</span><a href="GHC.Core.Make.html#FloatLet"><span class="hs-identifier hs-var">FloatLet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; InBind
forall b. b -&gt; Expr b -&gt; Bind b
</span><a href="GHC.Core.html#NonRec"><span class="hs-identifier hs-var">NonRec</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864566"><span class="hs-identifier hs-var">bndr'</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864568"><span class="hs-identifier hs-var">rhs'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1109"></span><span>         </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
forall {a}. Either a Subst
</span><a href="#local-6989586621680864567"><span class="hs-identifier hs-var">subst'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FloatBind
</span><a href="#local-6989586621680864565"><span class="hs-identifier hs-var">float</span></a></span><span class="annot"><span class="annottext">FloatBind -&gt; [FloatBind] -&gt; [FloatBind]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864573"><span class="hs-identifier hs-var">floats</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864570"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864569"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1110"></span><span>
</span><span id="line-1111"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864564"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864564"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864563"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864563"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Case"><span class="hs-identifier hs-type">Case</span></a></span><span> </span><span id="local-6989586621680864562"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864562"><span class="hs-identifier hs-var">scrut</span></a></span></span><span> </span><span id="local-6989586621680864561"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864561"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span id="local-6989586621680864560"><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680864560"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864559"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864559"><span class="hs-identifier hs-var">vars</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864558"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864558"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864557"><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864557"><span class="hs-identifier hs-var">cont</span></a></span></span><span>
</span><span id="line-1112"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-1113"></span><span>          </span><span id="local-6989586621680864556"><span class="annot"><span class="annottext">scrut' :: Expr Var
</span><a href="#local-6989586621680864556"><span class="hs-identifier hs-var hs-var">scrut'</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Expr Var -&gt; Expr Var
forall {a}. Either a Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864588"><span class="hs-identifier hs-var">subst_expr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864564"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864562"><span class="hs-identifier hs-var">scrut</span></a></span><span>
</span><span id="line-1114"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621680864555"><span class="annot"><span class="annottext">Either a Subst
</span><a href="#local-6989586621680864555"><span class="hs-identifier hs-var">subst'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864554"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864554"><span class="hs-identifier hs-var">b'</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
forall {a}. Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
</span><a href="#local-6989586621680864577"><span class="hs-identifier hs-var">subst_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864564"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864561"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1115"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621680864552"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864552"><span class="hs-identifier hs-var">subst''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864551"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864551"><span class="hs-identifier hs-var">vars'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [Var] -&gt; (Either InScopeSet Subst, [Var])
forall {t :: * -&gt; *}.
Traversable t =&gt;
Either InScopeSet Subst
-&gt; t Var -&gt; (Either InScopeSet Subst, t Var)
</span><a href="#local-6989586621680864550"><span class="hs-identifier hs-var">subst_bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
forall {a}. Either a Subst
</span><a href="#local-6989586621680864555"><span class="hs-identifier hs-var">subst'</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864559"><span class="hs-identifier hs-var">vars</span></a></span><span>
</span><span id="line-1116"></span><span>          </span><span id="local-6989586621680864549"><span class="annot"><span class="annottext">float :: FloatBind
</span><a href="#local-6989586621680864549"><span class="hs-identifier hs-var hs-var">float</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Var -&gt; AltCon -&gt; [Var] -&gt; FloatBind
</span><a href="GHC.Core.Make.html#FloatCase"><span class="hs-identifier hs-var">FloatCase</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864556"><span class="hs-identifier hs-var">scrut'</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864554"><span class="hs-identifier hs-var">b'</span></a></span><span> </span><span class="annot"><span class="annottext">AltCon
</span><a href="#local-6989586621680864560"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864551"><span class="hs-identifier hs-var">vars'</span></a></span><span>
</span><span id="line-1117"></span><span>         </span><span class="hs-keyword">in</span><span>
</span><span id="line-1118"></span><span>           </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864552"><span class="hs-identifier hs-var">subst''</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FloatBind
</span><a href="#local-6989586621680864549"><span class="hs-identifier hs-var">float</span></a></span><span class="annot"><span class="annottext">FloatBind -&gt; [FloatBind] -&gt; [FloatBind]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864563"><span class="hs-identifier hs-var">floats</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864558"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864557"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1119"></span><span>
</span><span id="line-1120"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680864547"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864547"><span class="hs-identifier hs-var">sub</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864546"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864546"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864545"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864545"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864544"><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864544"><span class="hs-identifier hs-var">cont</span></a></span></span><span>
</span><span id="line-1121"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Either InScopeSet Subst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; InScopeSet
</span><a href="GHC.Core.Subst.html#substInScope"><span class="hs-identifier hs-var">substInScope</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864547"><span class="hs-identifier hs-var">sub</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1122"></span><span>            </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864546"><span class="hs-identifier hs-var">floats</span></a></span><span>
</span><span id="line-1123"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Var -&gt; Expr Var
Subst -&gt; Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#lookupIdSubst"><span class="hs-identifier hs-var">lookupIdSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864547"><span class="hs-identifier hs-var">sub</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864545"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1124"></span><span>            </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864544"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1125"></span><span>
</span><span id="line-1126"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680864543"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864542"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864541"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864540"><span class="annot"><span class="annottext">cont :: ConCont
</span><a href="#local-6989586621680864540"><span class="hs-identifier hs-var">cont</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.SimpleOpt.html#CC"><span class="hs-identifier hs-type">CC</span></a></span><span> </span><span id="local-6989586621680864539"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680864538"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864538"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1127"></span><span>
</span><span id="line-1128"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864537"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864537"><span class="hs-identifier hs-var">con</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Maybe DataCon
</span><a href="GHC.Types.Id.html#isDataConWorkId_maybe"><span class="hs-identifier hs-var">isDataConWorkId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1129"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Expr Var -&gt; Bool) -&gt; [Expr Var] -&gt; BranchCount
forall a. (a -&gt; Bool) -&gt; [a] -&gt; BranchCount
</span><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier hs-var">count</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Bool
forall b. Expr b -&gt; Bool
</span><a href="GHC.Core.html#isValArg"><span class="hs-identifier hs-var">isValArg</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; BranchCount -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Var -&gt; BranchCount
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1130"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; [FloatBind]
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864534"><span class="hs-identifier hs-var">succeedWith</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (DataCon, [Type], [Expr Var])
 -&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var]))
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1131"></span><span>          </span><span class="annot"><span class="annottext">DataCon
-&gt; [Expr Var] -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-var">pushCoDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864537"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864538"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1132"></span><span>
</span><span id="line-1133"></span><span>        </span><span class="hs-comment">-- Look through data constructor wrappers: they inline late (See Note</span><span>
</span><span id="line-1134"></span><span>        </span><span class="hs-comment">-- [Activation for data constructor wrappers]) but we want to do</span><span>
</span><span id="line-1135"></span><span>        </span><span class="hs-comment">-- case-of-known-constructor optimisation eagerly (see Note</span><span>
</span><span id="line-1136"></span><span>        </span><span class="hs-comment">-- [exprIsConApp_maybe on data constructors with wrappers]).</span><span>
</span><span id="line-1137"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Id.html#isDataConWrapId"><span class="hs-identifier hs-var">isDataConWrapId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1138"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864531"><span class="annot"><span class="annottext">rhs :: Expr Var
</span><a href="#local-6989586621680864531"><span class="hs-identifier hs-var hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Expr Var
</span><a href="GHC.Core.html#uf_tmpl"><span class="hs-identifier hs-var hs-var">uf_tmpl</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="GHC.Types.Id.html#realIdUnfolding"><span class="hs-identifier hs-var">realIdUnfolding</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1139"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Either InScopeSet Subst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864531"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864540"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1140"></span><span>
</span><span id="line-1141"></span><span>        </span><span class="hs-comment">-- Look through dictionary functions; see Note [Unfolding DFuns]</span><span>
</span><span id="line-1142"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Core.html#DFunUnfolding"><span class="hs-identifier hs-type">DFunUnfolding</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">df_bndrs :: Unfolding -&gt; [Var]
</span><a href="GHC.Core.html#df_bndrs"><span class="hs-identifier hs-var">df_bndrs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864526"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864526"><span class="hs-identifier hs-var">bndrs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">df_con :: Unfolding -&gt; DataCon
</span><a href="GHC.Core.html#df_con"><span class="hs-identifier hs-var">df_con</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864524"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864524"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">df_args :: Unfolding -&gt; [Expr Var]
</span><a href="GHC.Core.html#df_args"><span class="hs-identifier hs-var">df_args</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680864522"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864522"><span class="hs-identifier hs-var">dfun_args</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864521"><span class="hs-identifier hs-var">unfolding</span></a></span><span>
</span><span id="line-1143"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864526"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-operator hs-var">`equalLength`</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span><span>    </span><span class="hs-comment">-- See Note [DFun arity check]</span><span>
</span><span id="line-1144"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864519"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680864519"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; [(Var, Expr Var)] -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkOpenSubst"><span class="hs-identifier hs-var">mkOpenSubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864526"><span class="hs-identifier hs-var">bndrs</span></a></span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; [(Var, Expr Var)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1145"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; [FloatBind]
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864534"><span class="hs-identifier hs-var">succeedWith</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (DataCon, [Type], [Expr Var])
 -&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var]))
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1146"></span><span>          </span><span class="annot"><span class="annottext">DataCon
-&gt; [Expr Var] -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-var">pushCoDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864524"><span class="hs-identifier hs-var">con</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Expr Var -&gt; Expr Var) -&gt; [Expr Var] -&gt; [Expr Var]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Expr Var -&gt; Expr Var
Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#substExpr"><span class="hs-identifier hs-var">substExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864519"><span class="hs-identifier hs-var">subst</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864522"><span class="hs-identifier hs-var">dfun_args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864538"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1147"></span><span>
</span><span id="line-1148"></span><span>        </span><span class="hs-comment">-- Look through unfoldings, but only arity-zero one;</span><span>
</span><span id="line-1149"></span><span>        </span><span class="hs-comment">-- if arity &gt; 0 we are effectively inlining a function call,</span><span>
</span><span id="line-1150"></span><span>        </span><span class="hs-comment">-- and that is the business of callSiteInline.</span><span>
</span><span id="line-1151"></span><span>        </span><span class="hs-comment">-- In practice, without this test, most of the &quot;hits&quot; were</span><span>
</span><span id="line-1152"></span><span>        </span><span class="hs-comment">-- CPR'd workers getting inlined back into their wrappers,</span><span>
</span><span id="line-1153"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; BranchCount
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; BranchCount -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1154"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864516"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864516"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Maybe (Expr Var)
</span><a href="GHC.Core.html#expandUnfolding_maybe"><span class="hs-identifier hs-var">expandUnfolding_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Unfolding
</span><a href="#local-6989586621680864521"><span class="hs-identifier hs-var">unfolding</span></a></span><span>
</span><span id="line-1155"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864514"><span class="annot"><span class="annottext">in_scope' :: InScopeSet
</span><a href="#local-6989586621680864514"><span class="hs-identifier hs-var hs-var">in_scope'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; VarSet -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#extendInScopeSetSet"><span class="hs-identifier hs-var">extendInScopeSetSet</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; VarSet
</span><a href="GHC.Core.FVs.html#exprFreeVars"><span class="hs-identifier hs-var">exprFreeVars</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864516"><span class="hs-identifier hs-var">rhs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1156"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
-&gt; [FloatBind]
-&gt; Expr Var
-&gt; ConCont
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Either InScopeSet Subst
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864514"><span class="hs-identifier hs-var">in_scope'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864516"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><a href="#local-6989586621680864540"><span class="hs-identifier hs-var">cont</span></a></span><span>
</span><span id="line-1157"></span><span>
</span><span id="line-1158"></span><span>        </span><span class="hs-comment">-- See Note [exprIsConApp_maybe on literal strings]</span><span>
</span><span id="line-1159"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#unpackCStringIdKey"><span class="hs-identifier hs-var">unpackCStringIdKey</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span>
</span><span id="line-1160"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Unique -&gt; Bool
forall a. Uniquable a =&gt; a -&gt; Unique -&gt; Bool
</span><a href="GHC.Types.Unique.html#hasKey"><span class="hs-operator hs-var">`hasKey`</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="GHC.Builtin.Names.html#unpackCStringUtf8IdKey"><span class="hs-identifier hs-var">unpackCStringUtf8IdKey</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1161"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span id="local-6989586621680864510"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864510"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">]</span><span>              </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864539"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1162"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Literal.html#LitString"><span class="hs-identifier hs-type">LitString</span></a></span><span> </span><span id="local-6989586621680864508"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864508"><span class="hs-identifier hs-var">str</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-var">exprIsLiteral_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864618"><span class="hs-identifier hs-var">id_unf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864510"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-1163"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
-&gt; [FloatBind]
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864534"><span class="hs-identifier hs-var">succeedWith</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864543"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864542"><span class="hs-identifier hs-var">floats</span></a></span><span> </span><span class="annot"><span class="annottext">(Maybe (DataCon, [Type], [Expr Var])
 -&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var]))
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1164"></span><span>          </span><span class="annot"><span class="annottext">Var
-&gt; ByteString -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#dealWithStringLiteral"><span class="hs-identifier hs-var">dealWithStringLiteral</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864508"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864538"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1165"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-1166"></span><span>          </span><span id="local-6989586621680864521"><span class="annot"><span class="annottext">unfolding :: Unfolding
</span><a href="#local-6989586621680864521"><span class="hs-identifier hs-var hs-var">unfolding</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864618"><span class="hs-identifier hs-var">id_unf</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864541"><span class="hs-identifier hs-var">fun</span></a></span><span>
</span><span id="line-1167"></span><span>
</span><span id="line-1168"></span><span>    </span><span class="annot"><a href="#local-6989586621680864616"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">ConCont
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1169"></span><span>
</span><span id="line-1170"></span><span>    </span><span class="annot"><a href="#local-6989586621680864534"><span class="hs-identifier hs-type">succeedWith</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier hs-type">FloatBind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1171"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1172"></span><span>                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.Make.html#FloatBind"><span class="hs-identifier hs-type">FloatBind</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1173"></span><span>    </span><span id="local-6989586621680864534"><span class="annot"><span class="annottext">succeedWith :: InScopeSet
-&gt; [FloatBind]
-&gt; Maybe (DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864534"><span class="hs-identifier hs-var hs-var">succeedWith</span></a></span></span><span> </span><span id="local-6989586621680864506"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864506"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span id="local-6989586621680864505"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864505"><span class="hs-identifier hs-var">rev_floats</span></a></span></span><span> </span><span id="local-6989586621680864504"><span class="annot"><span class="annottext">Maybe (DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864504"><span class="hs-identifier hs-var">x</span></a></span></span><span>
</span><span id="line-1174"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864503"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864503"><span class="hs-identifier hs-var">con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864502"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864502"><span class="hs-identifier hs-var">tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864501"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864501"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (DataCon, [Type], [Expr Var])
</span><a href="#local-6989586621680864504"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1175"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864500"><span class="annot"><span class="annottext">floats :: [FloatBind]
</span><a href="#local-6989586621680864500"><span class="hs-identifier hs-var hs-var">floats</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[FloatBind] -&gt; [FloatBind]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864505"><span class="hs-identifier hs-var">rev_floats</span></a></span><span>
</span><span id="line-1176"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864506"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864500"><span class="hs-identifier hs-var">floats</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864503"><span class="hs-identifier hs-var">con</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864502"><span class="hs-identifier hs-var">tys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864501"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1177"></span><span>
</span><span id="line-1178"></span><span>    </span><span class="hs-comment">----------------------------</span><span>
</span><span id="line-1179"></span><span>    </span><span class="hs-comment">-- Operations on the (Either InScopeSet GHC.Core.Subst)</span><span>
</span><span id="line-1180"></span><span>    </span><span class="hs-comment">-- The Left case is wildly dominant</span><span>
</span><span id="line-1181"></span><span>    </span><span id="local-6989586621680864598"><span class="annot"><span class="annottext">subst_co :: Either a Subst -&gt; CoercionR -&gt; CoercionR
</span><a href="#local-6989586621680864598"><span class="hs-identifier hs-var hs-var">subst_co</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864497"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864497"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864497"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1182"></span><span>    </span><span class="annot"><a href="#local-6989586621680864598"><span class="hs-identifier hs-var">subst_co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680864496"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864496"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864495"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864495"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasCallStack =&gt; Subst -&gt; CoercionR -&gt; CoercionR
Subst -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Subst.html#substCo"><span class="hs-identifier hs-var">GHC.Core.Subst.substCo</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864496"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864495"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1183"></span><span>
</span><span id="line-1184"></span><span>    </span><span id="local-6989586621680864588"><span class="annot"><span class="annottext">subst_expr :: Either a Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864588"><span class="hs-identifier hs-var hs-var">subst_expr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864492"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864492"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864492"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1185"></span><span>    </span><span class="annot"><a href="#local-6989586621680864588"><span class="hs-identifier hs-var">subst_expr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680864491"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864491"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864490"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864490"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Expr Var -&gt; Expr Var
Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#substExpr"><span class="hs-identifier hs-var">substExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864491"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864490"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1186"></span><span>
</span><span id="line-1187"></span><span>    </span><span id="local-6989586621680864577"><span class="annot"><span class="annottext">subst_bndr :: Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
</span><a href="#local-6989586621680864577"><span class="hs-identifier hs-var hs-var">subst_bndr</span></a></span></span><span> </span><span id="local-6989586621680864489"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864489"><span class="hs-identifier hs-var">msubst</span></a></span></span><span> </span><span id="local-6989586621680864488"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864488"><span class="hs-identifier hs-var">bndr</span></a></span></span><span>
</span><span id="line-1188"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Either a Subst
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864487"><span class="hs-identifier hs-var">subst'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864486"><span class="hs-identifier hs-var">bndr'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1189"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-1190"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864487"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864487"><span class="hs-identifier hs-var">subst'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864486"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864486"><span class="hs-identifier hs-var">bndr'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; (Subst, Var)
</span><a href="GHC.Core.Subst.html#substBndr"><span class="hs-identifier hs-var">substBndr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864484"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864488"><span class="hs-identifier hs-var">bndr</span></a></span><span>
</span><span id="line-1191"></span><span>        </span><span id="local-6989586621680864484"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680864484"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864489"><span class="hs-identifier hs-var">msubst</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1192"></span><span>                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680864483"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864483"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkEmptySubst"><span class="hs-identifier hs-var">mkEmptySubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864483"><span class="hs-identifier hs-var">in_scope</span></a></span><span>
</span><span id="line-1193"></span><span>                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680864482"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864482"><span class="hs-identifier hs-var">subst</span></a></span></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864482"><span class="hs-identifier hs-var">subst</span></a></span><span>
</span><span id="line-1194"></span><span>
</span><span id="line-1195"></span><span>    </span><span id="local-6989586621680864550"><span class="annot"><span class="annottext">subst_bndrs :: Either InScopeSet Subst
-&gt; t Var -&gt; (Either InScopeSet Subst, t Var)
</span><a href="#local-6989586621680864550"><span class="hs-identifier hs-var hs-var">subst_bndrs</span></a></span></span><span> </span><span id="local-6989586621680864479"><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864479"><span class="hs-identifier hs-var">subst</span></a></span></span><span> </span><span id="local-6989586621680864478"><span class="annot"><span class="annottext">t Var
</span><a href="#local-6989586621680864478"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Either InScopeSet Subst -&gt; Var -&gt; (Either InScopeSet Subst, Var))
-&gt; Either InScopeSet Subst
-&gt; t Var
-&gt; (Either InScopeSet Subst, t Var)
forall (t :: * -&gt; *) s a b.
Traversable t =&gt;
(s -&gt; a -&gt; (s, b)) -&gt; s -&gt; t a -&gt; (s, t b)
</span><a href="../../base/src/Data.Traversable.html#mapAccumL"><span class="hs-identifier hs-var">mapAccumL</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst -&gt; Var -&gt; (Either InScopeSet Subst, Var)
forall {a}. Either InScopeSet Subst -&gt; Var -&gt; (Either a Subst, Var)
</span><a href="#local-6989586621680864577"><span class="hs-identifier hs-var">subst_bndr</span></a></span><span> </span><span class="annot"><span class="annottext">Either InScopeSet Subst
</span><a href="#local-6989586621680864479"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">t Var
</span><a href="#local-6989586621680864478"><span class="hs-identifier hs-var">bs</span></a></span><span>
</span><span id="line-1196"></span><span>
</span><span id="line-1197"></span><span>    </span><span id="local-6989586621680864580"><span class="annot"><span class="annottext">extend :: Either InScopeSet Subst -&gt; Var -&gt; Expr Var -&gt; Either a Subst
</span><a href="#local-6989586621680864580"><span class="hs-identifier hs-var hs-var">extend</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680864477"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864477"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864476"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864476"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621680864475"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864475"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Either a Subst
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Expr Var -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendSubst"><span class="hs-identifier hs-var">extendSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkEmptySubst"><span class="hs-identifier hs-var">mkEmptySubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864477"><span class="hs-identifier hs-var">in_scope</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864476"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864475"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1198"></span><span>    </span><span class="annot"><a href="#local-6989586621680864580"><span class="hs-identifier hs-var">extend</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680864473"><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864473"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>       </span><span id="local-6989586621680864472"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864472"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621680864471"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864471"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Either a Subst
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Expr Var -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendSubst"><span class="hs-identifier hs-var">extendSubst</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864473"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864472"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864471"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1199"></span><span>
</span><span id="line-1200"></span><span>
</span><span id="line-1201"></span><span class="hs-comment">-- See Note [exprIsConApp_maybe on literal strings]</span><span>
</span><span id="line-1202"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#dealWithStringLiteral"><span class="hs-identifier hs-type">dealWithStringLiteral</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../bytestring/src/Data.ByteString.Internal.html#ByteString"><span class="hs-identifier hs-type">BS.ByteString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-1203"></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1204"></span><span>
</span><span id="line-1205"></span><span class="hs-comment">-- This is not possible with user-supplied empty literals, GHC.Core.Make.mkStringExprFS</span><span>
</span><span id="line-1206"></span><span class="hs-comment">-- turns those into [] automatically, but just in case something else in GHC</span><span>
</span><span id="line-1207"></span><span class="hs-comment">-- generates a string literal directly.</span><span>
</span><span id="line-1208"></span><span id="dealWithStringLiteral"><span class="annot"><span class="annottext">dealWithStringLiteral :: Var
-&gt; ByteString -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#dealWithStringLiteral"><span class="hs-identifier hs-var hs-var">dealWithStringLiteral</span></a></span></span><span> </span><span id="local-6989586621680864470"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864470"><span class="hs-identifier hs-var">fun</span></a></span></span><span> </span><span id="local-6989586621680864469"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864469"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680864468"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864468"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1209"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Maybe (Char, ByteString)
</span><a href="GHC.Utils.Encoding.html#utf8UnconsByteString"><span class="hs-identifier hs-var">utf8UnconsByteString</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864469"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1210"></span><span>    </span><span class="annot"><span class="annottext">Maybe (Char, ByteString)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DataCon
-&gt; [Expr Var] -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-var">pushCoDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#nilDataCon"><span class="hs-identifier hs-var">nilDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type -&gt; Expr Var
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#charTy"><span class="hs-identifier hs-var">charTy</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864468"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1211"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864464"><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680864464"><span class="hs-identifier hs-var">char</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864463"><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864463"><span class="hs-identifier hs-var">charTail</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1212"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864462"><span class="annot"><span class="annottext">char_expr :: Expr b
</span><a href="#local-6989586621680864462"><span class="hs-identifier hs-var hs-var">char_expr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Expr b] -&gt; Expr b
forall b. DataCon -&gt; [Arg b] -&gt; Arg b
</span><a href="GHC.Core.html#mkConApp"><span class="hs-identifier hs-var">mkConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#charDataCon"><span class="hs-identifier hs-var">charDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Char -&gt; Expr b
forall b. Char -&gt; Expr b
</span><a href="GHC.Core.html#mkCharLit"><span class="hs-identifier hs-var">mkCharLit</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><a href="#local-6989586621680864464"><span class="hs-identifier hs-var">char</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1213"></span><span>          </span><span class="hs-comment">-- In singleton strings, just add [] instead of unpackCstring# &quot;&quot;#.</span><span>
</span><span id="line-1214"></span><span>          </span><span id="local-6989586621680864458"><span class="annot"><span class="annottext">rest :: Expr b
</span><a href="#local-6989586621680864458"><span class="hs-identifier hs-var hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">ByteString -&gt; Bool
</span><a href="../../bytestring/src/Data.ByteString.html#null"><span class="hs-identifier hs-var">BS.null</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864463"><span class="hs-identifier hs-var">charTail</span></a></span><span>
</span><span id="line-1215"></span><span>                   </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Expr b] -&gt; Expr b
forall b. DataCon -&gt; [Arg b] -&gt; Arg b
</span><a href="GHC.Core.html#mkConApp"><span class="hs-identifier hs-var">mkConApp</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#nilDataCon"><span class="hs-identifier hs-var">nilDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type -&gt; Expr b
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#charTy"><span class="hs-identifier hs-var">charTy</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1216"></span><span>                   </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Expr b -&gt; Expr b -&gt; Expr b
forall b. Expr b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#App"><span class="hs-identifier hs-var">App</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr b
forall b. Var -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864470"><span class="hs-identifier hs-var">fun</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1217"></span><span>                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Literal -&gt; Expr b
forall b. Literal -&gt; Expr b
</span><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-var">Lit</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ByteString -&gt; Literal
</span><a href="GHC.Types.Literal.html#LitString"><span class="hs-identifier hs-var">LitString</span></a></span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="#local-6989586621680864463"><span class="hs-identifier hs-var">charTail</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1218"></span><span>
</span><span id="line-1219"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">DataCon
-&gt; [Expr Var] -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-var">pushCoDataCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#consDataCon"><span class="hs-identifier hs-var">consDataCon</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Type -&gt; Expr Var
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="GHC.Builtin.Types.html#charTy"><span class="hs-identifier hs-var">charTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
forall {b}. Expr b
</span><a href="#local-6989586621680864462"><span class="hs-identifier hs-var">char_expr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
forall {b}. Expr b
</span><a href="#local-6989586621680864458"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864468"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1220"></span><span>
</span><span id="line-1221"></span><span class="hs-comment">{-
Note [Unfolding DFuns]
~~~~~~~~~~~~~~~~~~~~~~
DFuns look like

  df :: forall a b. (Eq a, Eq b) -&gt; Eq (a,b)
  df a b d_a d_b = MkEqD (a,b) ($c1 a b d_a d_b)
                               ($c2 a b d_a d_b)

So to split it up we just need to apply the ops $c1, $c2 etc
to the very same args as the dfun.  It takes a little more work
to compute the type arguments to the dictionary constructor.

Note [DFun arity check]
~~~~~~~~~~~~~~~~~~~~~~~
Here we check that the total number of supplied arguments (including
type args) matches what the dfun is expecting.  This may be *less*
than the ordinary arity of the dfun: see Note [DFun unfoldings] in GHC.Core
-}</span><span>
</span><span id="line-1240"></span><span>
</span><span id="line-1241"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-type">exprIsLiteral_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#InScopeEnv"><span class="hs-identifier hs-type">InScopeEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Literal.html#Literal"><span class="hs-identifier hs-type">Literal</span></a></span><span>
</span><span id="line-1242"></span><span class="hs-comment">-- Same deal as exprIsConApp_maybe, but much simpler</span><span>
</span><span id="line-1243"></span><span class="hs-comment">-- Nevertheless we do need to look through unfoldings for</span><span>
</span><span id="line-1244"></span><span class="hs-comment">-- Integer and string literals, which are vigorously hoisted to top level</span><span>
</span><span id="line-1245"></span><span class="hs-comment">-- and not subsequently inlined</span><span>
</span><span id="line-1246"></span><span id="exprIsLiteral_maybe"><span class="annot"><span class="annottext">exprIsLiteral_maybe :: (InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-var hs-var">exprIsLiteral_maybe</span></a></span></span><span> </span><span id="local-6989586621680864455"><span class="annot"><span class="annottext">env :: (InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864455"><span class="hs-identifier hs-var">env</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864454"><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864454"><span class="hs-identifier hs-var">id_unf</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864453"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864453"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-1247"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864453"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1248"></span><span>      </span><span class="annot"><a href="GHC.Core.html#Lit"><span class="hs-identifier hs-type">Lit</span></a></span><span> </span><span id="local-6989586621680864452"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864452"><span class="hs-identifier hs-var">l</span></a></span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864452"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1249"></span><span>      </span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680864451"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864451"><span class="hs-identifier hs-var">e'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-var">exprIsLiteral_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864455"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864451"><span class="hs-identifier hs-var">e'</span></a></span><span> </span><span class="hs-comment">-- dubious?</span><span>
</span><span id="line-1250"></span><span>      </span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864450"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864450"><span class="hs-identifier hs-var">v</span></a></span></span><span>
</span><span id="line-1251"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864449"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864449"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Maybe (Expr Var)
</span><a href="GHC.Core.html#expandUnfolding_maybe"><span class="hs-identifier hs-var">expandUnfolding_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864454"><span class="hs-identifier hs-var">id_unf</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864450"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1252"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864448"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864448"><span class="hs-identifier hs-var">l</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-var">exprIsLiteral_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864455"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864449"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-1253"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864448"><span class="hs-identifier hs-var">l</span></a></span><span>
</span><span id="line-1254"></span><span>      </span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864447"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864447"><span class="hs-identifier hs-var">v</span></a></span></span><span>
</span><span id="line-1255"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864446"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864446"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Maybe (Expr Var)
</span><a href="GHC.Core.html#expandUnfolding_maybe"><span class="hs-identifier hs-var">expandUnfolding_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864454"><span class="hs-identifier hs-var">id_unf</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864447"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1256"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864445"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864445"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="#local-6989586621680864444"><span class="hs-identifier hs-var">matchBignum</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864455"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864446"><span class="hs-identifier hs-var">rhs</span></a></span><span>
</span><span id="line-1257"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864445"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1258"></span><span>      </span><span id="local-6989586621680864443"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864443"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-1259"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864442"><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864442"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="#local-6989586621680864444"><span class="hs-identifier hs-var">matchBignum</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864455"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864443"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1260"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">Literal
</span><a href="#local-6989586621680864442"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1261"></span><span>
</span><span id="line-1262"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1263"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Literal
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1264"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1265"></span><span>    </span><span id="local-6989586621680864444"><span class="annot"><span class="annottext">matchBignum :: (InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="#local-6989586621680864444"><span class="hs-identifier hs-var hs-var">matchBignum</span></a></span></span><span> </span><span id="local-6989586621680864437"><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864437"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680864436"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864436"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-1266"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864435"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864435"><span class="hs-identifier hs-var">_env</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864434"><span class="annot"><span class="annottext">[FloatBind]
</span><a href="#local-6989586621680864434"><span class="hs-identifier hs-var">_fb</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864433"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864433"><span class="hs-identifier hs-var">dc</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864432"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864432"><span class="hs-identifier hs-var">_tys</span></a></span></span><span class="hs-special">,</span><span class="hs-special">[</span><span id="local-6989586621680864431"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864431"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
HasDebugCallStack =&gt;
(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var
-&gt; Maybe (InScopeSet, [FloatBind], DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsConApp_maybe"><span class="hs-identifier hs-var">exprIsConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864437"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864436"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1267"></span><span>         </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Literal.html#LitNumber"><span class="hs-identifier hs-type">LitNumber</span></a></span><span> </span><span class="annot"><span class="annottext">LitNumType
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680864429"><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680864429"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun) -&gt; Expr Var -&gt; Maybe Literal
</span><a href="GHC.Core.SimpleOpt.html#exprIsLiteral_maybe"><span class="hs-identifier hs-var">exprIsLiteral_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><a href="#local-6989586621680864437"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864431"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-1268"></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span>
</span><span id="line-1269"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864433"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; DataCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#naturalNSDataCon"><span class="hs-identifier hs-var">naturalNSDataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Literal
</span><a href="GHC.Types.Literal.html#mkLitNatural"><span class="hs-identifier hs-var">mkLitNatural</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680864429"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1270"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864433"><span class="hs-identifier hs-var">dc</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; DataCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="GHC.Builtin.Types.html#integerISDataCon"><span class="hs-identifier hs-var">integerISDataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Literal -&gt; Maybe Literal
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Integer -&gt; Literal
</span><a href="GHC.Types.Literal.html#mkLitInteger"><span class="hs-identifier hs-var">mkLitInteger</span></a></span><span> </span><span class="annot"><span class="annottext">Integer
</span><a href="#local-6989586621680864429"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1271"></span><span>            </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe Literal
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1272"></span><span>         </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1273"></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe Literal
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1274"></span><span>
</span><span id="line-1275"></span><span class="hs-comment">{-
Note [exprIsLambda_maybe]
~~~~~~~~~~~~~~~~~~~~~~~~~~
exprIsLambda_maybe will, given an expression `e`, try to turn it into the form
`Lam v e'` (returned as `Just (v,e')`). Besides using lambdas, it looks through
casts (using the Push rule), and it unfolds function calls if the unfolding
has a greater arity than arguments are present.

Currently, it is used in GHC.Core.Rules.match, and is required to make
&quot;map coerce = coerce&quot; match.
-}</span><span>
</span><span id="line-1286"></span><span>
</span><span id="line-1287"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-type">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#InScopeEnv"><span class="hs-identifier hs-type">InScopeEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span>
</span><span id="line-1288"></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">,</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1289"></span><span>    </span><span class="hs-comment">-- See Note [exprIsLambda_maybe]</span><span>
</span><span id="line-1290"></span><span>
</span><span id="line-1291"></span><span class="hs-comment">-- The simple case: It is a lambda already</span><span>
</span><span id="line-1292"></span><span id="exprIsLambda_maybe"><span class="annot"><span class="annottext">exprIsLambda_maybe :: (InScopeSet, IdUnfoldingFun)
-&gt; Expr Var -&gt; Maybe (Var, Expr Var, [Tickish Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var hs-var">exprIsLambda_maybe</span></a></span></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864424"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864424"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680864423"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864423"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1293"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var, [Tickish Var])
-&gt; Maybe (Var, Expr Var, [Tickish Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864424"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864423"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1294"></span><span>
</span><span id="line-1295"></span><span class="hs-comment">-- Still straightforward: Ticks that we can float out of the way</span><span>
</span><span id="line-1296"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864422"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864422"><span class="hs-identifier hs-var">in_scope_set</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864421"><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864421"><span class="hs-identifier hs-var">id_unf</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tick"><span class="hs-identifier hs-type">Tick</span></a></span><span> </span><span id="local-6989586621680864420"><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864420"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span id="local-6989586621680864419"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864419"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1297"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishFloatable"><span class="hs-identifier hs-var">tickishFloatable</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864420"><span class="hs-identifier hs-var">t</span></a></span><span>
</span><span id="line-1298"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864417"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864417"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864416"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864416"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864415"><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864415"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var -&gt; Maybe (Var, Expr Var, [Tickish Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864422"><span class="hs-identifier hs-var">in_scope_set</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864421"><span class="hs-identifier hs-var">id_unf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864419"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1299"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var, [Tickish Var])
-&gt; Maybe (Var, Expr Var, [Tickish Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864417"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864416"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Tickish Var
</span><a href="#local-6989586621680864420"><span class="hs-identifier hs-var">t</span></a></span><span class="annot"><span class="annottext">Tickish Var -&gt; [Tickish Var] -&gt; [Tickish Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864415"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1300"></span><span>
</span><span id="line-1301"></span><span class="hs-comment">-- Also possible: A casted lambda. Push the coercion inside</span><span>
</span><span id="line-1302"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864414"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864414"><span class="hs-identifier hs-var">in_scope_set</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864413"><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864413"><span class="hs-identifier hs-var">id_unf</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864412"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864412"><span class="hs-identifier hs-var">casted_e</span></a></span></span><span> </span><span id="local-6989586621680864411"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864411"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1303"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864410"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864410"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864409"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864409"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864408"><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864408"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var -&gt; Maybe (Var, Expr Var, [Tickish Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864414"><span class="hs-identifier hs-var">in_scope_set</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864413"><span class="hs-identifier hs-var">id_unf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864412"><span class="hs-identifier hs-var">casted_e</span></a></span><span>
</span><span id="line-1304"></span><span>    </span><span class="hs-comment">-- Only do value lambdas.</span><span>
</span><span id="line-1305"></span><span>    </span><span class="hs-comment">-- this implies that x is not in scope in gamma (makes this code simpler)</span><span>
</span><span id="line-1306"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864410"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isCoVar"><span class="hs-identifier hs-var">isCoVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864410"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1307"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">x</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">elemVarSet</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">tyCoVarsOfCo</span><span> </span><span class="hs-identifier">co</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">True</span><span>
</span><span id="line-1308"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864405"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864405"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864404"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864404"><span class="hs-identifier hs-var">e'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Var -&gt; Expr Var -&gt; CoercionR -&gt; Maybe (Var, Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#pushCoercionIntoLambda"><span class="hs-identifier hs-var">pushCoercionIntoLambda</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864414"><span class="hs-identifier hs-var">in_scope_set</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864410"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864409"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864411"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1309"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864402"><span class="annot"><span class="annottext">res :: Maybe (Var, Expr Var, [Tickish Var])
</span><a href="#local-6989586621680864402"><span class="hs-identifier hs-var hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var, [Tickish Var])
-&gt; Maybe (Var, Expr Var, [Tickish Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864405"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864404"><span class="hs-identifier hs-var">e'</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864408"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1310"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">--pprTrace &quot;exprIsLambda_maybe:Cast&quot; (vcat [ppr casted_e,ppr co,ppr res)])</span><span>
</span><span id="line-1311"></span><span>      </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var, [Tickish Var])
</span><a href="#local-6989586621680864402"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1312"></span><span>
</span><span id="line-1313"></span><span class="hs-comment">-- Another attempt: See if we find a partial unfolding</span><span>
</span><span id="line-1314"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864401"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864401"><span class="hs-identifier hs-var">in_scope_set</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864400"><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864400"><span class="hs-identifier hs-var">id_unf</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864399"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864399"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-1315"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span id="local-6989586621680864398"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864398"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864397"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864397"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864396"><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864396"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Tickish Var -&gt; Bool)
-&gt; Expr Var -&gt; (Expr Var, [Expr Var], [Tickish Var])
forall b.
(Tickish Var -&gt; Bool)
-&gt; Expr b -&gt; (Expr b, [Expr b], [Tickish Var])
</span><a href="GHC.Core.html#collectArgsTicks"><span class="hs-identifier hs-var">collectArgsTicks</span></a></span><span> </span><span class="annot"><span class="annottext">Tickish Var -&gt; Bool
forall id. Tickish id -&gt; Bool
</span><a href="GHC.Core.html#tickishFloatable"><span class="hs-identifier hs-var">tickishFloatable</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864399"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1316"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Var -&gt; BranchCount
</span><a href="GHC.Types.Id.html#idArity"><span class="hs-identifier hs-var">idArity</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864398"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; BranchCount -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span> </span><span class="annot"><span class="annottext">(Expr Var -&gt; Bool) -&gt; [Expr Var] -&gt; BranchCount
forall a. (a -&gt; Bool) -&gt; [a] -&gt; BranchCount
</span><a href="GHC.Utils.Misc.html#count"><span class="hs-identifier hs-var">count</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Bool
forall b. Expr b -&gt; Bool
</span><a href="GHC.Core.html#isValArg"><span class="hs-identifier hs-var">isValArg</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864397"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-1317"></span><span>    </span><span class="hs-comment">-- Make sure there is hope to get a lambda</span><span>
</span><span id="line-1318"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680864393"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864393"><span class="hs-identifier hs-var">rhs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Unfolding -&gt; Maybe (Expr Var)
</span><a href="GHC.Core.html#expandUnfolding_maybe"><span class="hs-identifier hs-var">expandUnfolding_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864400"><span class="hs-identifier hs-var">id_unf</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864398"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1319"></span><span>    </span><span class="hs-comment">-- Optimize, for beta-reduction</span><span>
</span><span id="line-1320"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864391"><span class="annot"><span class="annottext">e' :: Expr Var
</span><a href="#local-6989586621680864391"><span class="hs-identifier hs-var hs-var">e'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; DynFlags -&gt; Subst -&gt; Expr Var -&gt; Expr Var
DynFlags -&gt; Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.SimpleOpt.html#simpleOptExprWith"><span class="hs-identifier hs-var">simpleOptExprWith</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="GHC.Driver.Session.html#unsafeGlobalDynFlags"><span class="hs-identifier hs-var">unsafeGlobalDynFlags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkEmptySubst"><span class="hs-identifier hs-var">mkEmptySubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864401"><span class="hs-identifier hs-var">in_scope_set</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864393"><span class="hs-identifier hs-var">rhs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; [Expr Var] -&gt; Expr Var
forall b. Expr b -&gt; [Expr b] -&gt; Expr b
</span><a href="GHC.Core.html#mkApps"><span class="hs-operator hs-var">`mkApps`</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864397"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1321"></span><span>    </span><span class="hs-comment">-- Recurse, because of possible casts</span><span>
</span><span id="line-1322"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864388"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864388"><span class="hs-identifier hs-var">x'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864387"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864387"><span class="hs-identifier hs-var">e''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864386"><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864386"><span class="hs-identifier hs-var">ts'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
-&gt; Expr Var -&gt; Maybe (Var, Expr Var, [Tickish Var])
</span><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864401"><span class="hs-identifier hs-var">in_scope_set</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">IdUnfoldingFun
</span><a href="#local-6989586621680864400"><span class="hs-identifier hs-var">id_unf</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864391"><span class="hs-identifier hs-var">e'</span></a></span><span>
</span><span id="line-1323"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864385"><span class="annot"><span class="annottext">res :: Maybe (Var, Expr Var, [Tickish Var])
</span><a href="#local-6989586621680864385"><span class="hs-identifier hs-var hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var, [Tickish Var])
-&gt; Maybe (Var, Expr Var, [Tickish Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864388"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864387"><span class="hs-identifier hs-var">e''</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864396"><span class="hs-identifier hs-var">ts</span></a></span><span class="annot"><span class="annottext">[Tickish Var] -&gt; [Tickish Var] -&gt; [Tickish Var]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">[Tickish Var]
</span><a href="#local-6989586621680864386"><span class="hs-identifier hs-var">ts'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- pprTrace &quot;exprIsLambda_maybe:Unfold&quot; (vcat [ppr e, ppr (x',e'')])</span><span>
</span><span id="line-1325"></span><span>      </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var, [Tickish Var])
</span><a href="#local-6989586621680864385"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1326"></span><span>
</span><span id="line-1327"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#exprIsLambda_maybe"><span class="hs-identifier hs-var">exprIsLambda_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">(InScopeSet, IdUnfoldingFun)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680864384"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864384"><span class="hs-identifier hs-var">_e</span></a></span></span><span>
</span><span id="line-1328"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- pprTrace &quot;exprIsLambda_maybe:Fail&quot; (vcat [ppr _e])</span><span>
</span><span id="line-1329"></span><span>      </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var, [Tickish Var])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1330"></span><span>
</span><span id="line-1331"></span><span>
</span><span id="line-1332"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
              The &quot;push rules&quot;
*                                                                      *
************************************************************************

Here we implement the &quot;push rules&quot; from FC papers:

* The push-argument rules, where we can move a coercion past an argument.
  We have
      (fun |&gt; co) arg
  and we want to transform it to
    (fun arg') |&gt; co'
  for some suitable co' and transformed arg'.

* The PushK rule for data constructors.  We have
       (K e1 .. en) |&gt; co
  and we want to transform to
       (K e1' .. en')
  by pushing the coercion into the arguments
-}</span><span>
</span><span id="line-1353"></span><span>
</span><span id="line-1354"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoArgs"><span class="hs-identifier hs-type">pushCoArgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCoercion"><span class="hs-identifier hs-type">MCoercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1355"></span><span id="pushCoArgs"><span class="annot"><span class="annottext">pushCoArgs :: CoercionR -&gt; [Expr Var] -&gt; Maybe ([Expr Var], MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoArgs"><span class="hs-identifier hs-var hs-var">pushCoArgs</span></a></span></span><span> </span><span id="local-6989586621680864382"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864382"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Expr Var], MCoercion) -&gt; Maybe ([Expr Var], MCoercion)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-var">MCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864382"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1356"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoArgs"><span class="hs-identifier hs-var">pushCoArgs</span></a></span><span> </span><span id="local-6989586621680864381"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864381"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864380"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864380"><span class="hs-identifier hs-var">arg</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680864379"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864379"><span class="hs-identifier hs-var">args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864378"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864378"><span class="hs-identifier hs-var">arg'</span></a></span></span><span class="hs-special">,</span><span>  </span><span id="local-6989586621680864377"><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864377"><span class="hs-identifier hs-var">m_co1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Expr Var -&gt; Maybe (Expr Var, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoArg"><span class="hs-identifier hs-var">pushCoArg</span></a></span><span>  </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864381"><span class="hs-identifier hs-var">co</span></a></span><span>  </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864380"><span class="hs-identifier hs-var">arg</span></a></span><span>
</span><span id="line-1357"></span><span>                              </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864377"><span class="hs-identifier hs-var">m_co1</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1358"></span><span>                                  </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-type">MCo</span></a></span><span> </span><span id="local-6989586621680864376"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864376"><span class="hs-identifier hs-var">co1</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864375"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864375"><span class="hs-identifier hs-var">args'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864374"><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864374"><span class="hs-identifier hs-var">m_co2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; [Expr Var] -&gt; Maybe ([Expr Var], MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoArgs"><span class="hs-identifier hs-var">pushCoArgs</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864376"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864379"><span class="hs-identifier hs-var">args</span></a></span><span>
</span><span id="line-1359"></span><span>                                                 </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([Expr Var], MCoercion) -&gt; Maybe ([Expr Var], MCoercion)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864378"><span class="hs-identifier hs-var">arg'</span></a></span><span class="annot"><span class="annottext">Expr Var -&gt; [Expr Var] -&gt; [Expr Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864375"><span class="hs-identifier hs-var">args'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864374"><span class="hs-identifier hs-var">m_co2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1360"></span><span>                                  </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">([Expr Var], MCoercion) -&gt; Maybe ([Expr Var], MCoercion)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864378"><span class="hs-identifier hs-var">arg'</span></a></span><span class="annot"><span class="annottext">Expr Var -&gt; [Expr Var] -&gt; [Expr Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864379"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1361"></span><span>
</span><span id="line-1362"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoArg"><span class="hs-identifier hs-type">pushCoArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#CoreArg"><span class="hs-identifier hs-type">CoreArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCoercion"><span class="hs-identifier hs-type">MCoercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1363"></span><span class="hs-comment">-- We have (fun |&gt; co) arg, and we want to transform it to</span><span>
</span><span id="line-1364"></span><span class="hs-comment">--         (fun arg) |&gt; co</span><span>
</span><span id="line-1365"></span><span class="hs-comment">-- This may fail, e.g. if (fun :: N) where N is a newtype</span><span>
</span><span id="line-1366"></span><span class="hs-comment">-- C.f. simplCast in GHC.Core.Opt.Simplify</span><span>
</span><span id="line-1367"></span><span class="hs-comment">-- 'co' is always Representational</span><span>
</span><span id="line-1368"></span><span class="hs-comment">-- If the returned coercion is Nothing, then it would have been reflexive</span><span>
</span><span id="line-1369"></span><span id="pushCoArg"><span class="annot"><span class="annottext">pushCoArg :: CoercionR -&gt; Expr Var -&gt; Maybe (Expr Var, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoArg"><span class="hs-identifier hs-var hs-var">pushCoArg</span></a></span></span><span> </span><span id="local-6989586621680864373"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864373"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span id="local-6989586621680864372"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864372"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864371"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864371"><span class="hs-identifier hs-var">ty'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864370"><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864370"><span class="hs-identifier hs-var">m_co'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Type -&gt; Maybe (Type, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoTyArg"><span class="hs-identifier hs-var">pushCoTyArg</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864373"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864372"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1370"></span><span>                            </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Expr Var, MCoercion) -&gt; Maybe (Expr Var, MCoercion)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; Expr Var
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864371"><span class="hs-identifier hs-var">ty'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864370"><span class="hs-identifier hs-var">m_co'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1371"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoArg"><span class="hs-identifier hs-var">pushCoArg</span></a></span><span> </span><span id="local-6989586621680864369"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864369"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span id="local-6989586621680864368"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864368"><span class="hs-identifier hs-var">val_arg</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864367"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864367"><span class="hs-identifier hs-var">arg_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864366"><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864366"><span class="hs-identifier hs-var">m_co'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Maybe (CoercionR, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoValArg"><span class="hs-identifier hs-var">pushCoValArg</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864369"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1372"></span><span>                            </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Expr Var, MCoercion) -&gt; Maybe (Expr Var, MCoercion)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864368"><span class="hs-identifier hs-var">val_arg</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-operator hs-var">`mkCast`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864367"><span class="hs-identifier hs-var">arg_co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="#local-6989586621680864366"><span class="hs-identifier hs-var">m_co'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1373"></span><span>
</span><span id="line-1374"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoTyArg"><span class="hs-identifier hs-type">pushCoTyArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCoercionR"><span class="hs-identifier hs-type">MCoercionR</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1375"></span><span class="hs-comment">-- We have (fun |&gt; co) @ty</span><span>
</span><span id="line-1376"></span><span class="hs-comment">-- Push the coercion through to return</span><span>
</span><span id="line-1377"></span><span class="hs-comment">--         (fun @ty') |&gt; co'</span><span>
</span><span id="line-1378"></span><span class="hs-comment">-- 'co' is always Representational</span><span>
</span><span id="line-1379"></span><span class="hs-comment">-- If the returned coercion is Nothing, then it would have been reflexive;</span><span>
</span><span id="line-1380"></span><span class="hs-comment">-- it's faster not to compute it, though.</span><span>
</span><span id="line-1381"></span><span id="pushCoTyArg"><span class="annot"><span class="annottext">pushCoTyArg :: CoercionR -&gt; Type -&gt; Maybe (Type, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoTyArg"><span class="hs-identifier hs-var hs-var">pushCoTyArg</span></a></span></span><span> </span><span id="local-6989586621680864363"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864363"><span class="hs-identifier hs-var">co</span></a></span></span><span> </span><span id="local-6989586621680864362"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864362"><span class="hs-identifier hs-var">ty</span></a></span></span><span>
</span><span id="line-1382"></span><span>  </span><span class="hs-comment">-- The following is inefficient - don't do `eqType` here, the coercion</span><span>
</span><span id="line-1383"></span><span>  </span><span class="hs-comment">-- optimizer will take care of it. See #14737.</span><span>
</span><span id="line-1384"></span><span>  </span><span class="hs-comment">-- -- | tyL `eqType` tyR</span><span>
</span><span id="line-1385"></span><span>  </span><span class="hs-comment">-- -- = Just (ty, Nothing)</span><span>
</span><span id="line-1386"></span><span>
</span><span id="line-1387"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864363"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1388"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type, MCoercion) -&gt; Maybe (Type, MCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864362"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1389"></span><span>
</span><span id="line-1390"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy_ty"><span class="hs-identifier hs-var">isForAllTy_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864359"><span class="hs-identifier hs-var">tyL</span></a></span><span>
</span><span id="line-1391"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isForAllTy_ty</span><span> </span><span class="hs-identifier">tyR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">co</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ty</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1392"></span><span>    </span><span class="annot"><span class="annottext">(Type, MCoercion) -&gt; Maybe (Type, MCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864362"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; CoercionR -&gt; Type
</span><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-operator hs-var">`mkCastTy`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864356"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-var">MCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864355"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1393"></span><span>
</span><span id="line-1394"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1395"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Type, MCoercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1396"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1397"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864359"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864359"><span class="hs-identifier hs-var">tyL</span></a></span></span><span> </span><span id="local-6989586621680864358"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864358"><span class="hs-identifier hs-var">tyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864363"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1398"></span><span>       </span><span class="hs-comment">-- co :: tyL ~ tyR</span><span>
</span><span id="line-1399"></span><span>       </span><span class="hs-comment">-- tyL = forall (a1 :: k1). ty1</span><span>
</span><span id="line-1400"></span><span>       </span><span class="hs-comment">-- tyR = forall (a2 :: k2). ty2</span><span>
</span><span id="line-1401"></span><span>
</span><span id="line-1402"></span><span>    </span><span id="local-6989586621680864356"><span class="annot"><span class="annottext">co1 :: CoercionR
</span><a href="#local-6989586621680864356"><span class="hs-identifier hs-var hs-var">co1</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864363"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1403"></span><span>       </span><span class="hs-comment">-- co1 :: k2 ~N k1</span><span>
</span><span id="line-1404"></span><span>       </span><span class="hs-comment">-- Note that NthCo can extract a Nominal equality between the</span><span>
</span><span id="line-1405"></span><span>       </span><span class="hs-comment">-- kinds of the types related by a coercion between forall-types.</span><span>
</span><span id="line-1406"></span><span>       </span><span class="hs-comment">-- See the NthCo case in GHC.Core.Lint.</span><span>
</span><span id="line-1407"></span><span>
</span><span id="line-1408"></span><span>    </span><span id="local-6989586621680864355"><span class="annot"><span class="annottext">co2 :: CoercionR
</span><a href="#local-6989586621680864355"><span class="hs-identifier hs-var hs-var">co2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864363"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Role -&gt; Type -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkGReflLeftCo"><span class="hs-identifier hs-var">mkGReflLeftCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864362"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864356"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1409"></span><span>        </span><span class="hs-comment">-- co2 :: ty1[ (ty|&gt;co1)/a1 ] ~ ty2[ ty/a2 ]</span><span>
</span><span id="line-1410"></span><span>        </span><span class="hs-comment">-- Arg of mkInstCo is always nominal, hence mkNomReflCo</span><span>
</span><span id="line-1411"></span><span>
</span><span id="line-1412"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoValArg"><span class="hs-identifier hs-type">pushCoValArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#MCoercion"><span class="hs-identifier hs-type">MCoercion</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1413"></span><span class="hs-comment">-- We have (fun |&gt; co) arg</span><span>
</span><span id="line-1414"></span><span class="hs-comment">-- Push the coercion through to return</span><span>
</span><span id="line-1415"></span><span class="hs-comment">--         (fun (arg |&gt; co_arg)) |&gt; co_res</span><span>
</span><span id="line-1416"></span><span class="hs-comment">-- 'co' is always Representational</span><span>
</span><span id="line-1417"></span><span class="hs-comment">-- If the second returned Coercion is actually Nothing, then no cast is necessary;</span><span>
</span><span id="line-1418"></span><span class="hs-comment">-- the returned coercion would have been reflexive.</span><span>
</span><span id="line-1419"></span><span id="pushCoValArg"><span class="annot"><span class="annottext">pushCoValArg :: CoercionR -&gt; Maybe (CoercionR, MCoercion)
</span><a href="GHC.Core.SimpleOpt.html#pushCoValArg"><span class="hs-identifier hs-var hs-var">pushCoValArg</span></a></span></span><span> </span><span id="local-6989586621680864346"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864346"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1420"></span><span>  </span><span class="hs-comment">-- The following is inefficient - don't do `eqType` here, the coercion</span><span>
</span><span id="line-1421"></span><span>  </span><span class="hs-comment">-- optimizer will take care of it. See #14737.</span><span>
</span><span id="line-1422"></span><span>  </span><span class="hs-comment">-- -- | tyL `eqType` tyR</span><span>
</span><span id="line-1423"></span><span>  </span><span class="hs-comment">-- -- = Just (mkRepReflCo arg, Nothing)</span><span>
</span><span id="line-1424"></span><span>
</span><span id="line-1425"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864346"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1426"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CoercionR, MCoercion) -&gt; Maybe (CoercionR, MCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkRepReflCo"><span class="hs-identifier hs-var">mkRepReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864345"><span class="hs-identifier hs-var">arg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MRefl"><span class="hs-identifier hs-var">MRefl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1427"></span><span>
</span><span id="line-1428"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isFunTy"><span class="hs-identifier hs-var">isFunTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864343"><span class="hs-identifier hs-var">tyL</span></a></span><span>
</span><span id="line-1429"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864342"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864342"><span class="hs-identifier hs-var">co_mult</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864341"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864341"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864340"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864340"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
</span><a href="GHC.Core.Coercion.html#decomposeFunCo"><span class="hs-identifier hs-var">decomposeFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864346"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1430"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflexiveCo"><span class="hs-identifier hs-var">isReflexiveCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864342"><span class="hs-identifier hs-var">co_mult</span></a></span><span>
</span><span id="line-1431"></span><span>    </span><span class="hs-comment">-- We can't push the coercion in the case where co_mult isn't reflexivity:</span><span>
</span><span id="line-1432"></span><span>    </span><span class="hs-comment">-- it could be an unsafe axiom, and losing this information could yield</span><span>
</span><span id="line-1433"></span><span>    </span><span class="hs-comment">-- ill-typed terms. For instance (fun x ::(1) Int -&gt; (fun _ -&gt; () |&gt; co) x)</span><span>
</span><span id="line-1434"></span><span>    </span><span class="hs-comment">-- with co :: (Int -&gt; ()) ~ (Int %1 -&gt; ()), would reduce to (fun x ::(1) Int</span><span>
</span><span id="line-1435"></span><span>    </span><span class="hs-comment">-- -&gt; (fun _ ::(Many) Int -&gt; ()) x) which is ill-typed</span><span>
</span><span id="line-1436"></span><span>
</span><span id="line-1437"></span><span>              </span><span class="hs-comment">-- If   co  :: (tyL1 -&gt; tyL2) ~ (tyR1 -&gt; tyR2)</span><span>
</span><span id="line-1438"></span><span>              </span><span class="hs-comment">-- then co1 :: tyL1 ~ tyR1</span><span>
</span><span id="line-1439"></span><span>              </span><span class="hs-comment">--      co2 :: tyL2 ~ tyR2</span><span>
</span><span id="line-1440"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isFunTy</span><span> </span><span class="hs-identifier">tyR</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">co</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">arg</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1441"></span><span>    </span><span class="annot"><span class="annottext">(CoercionR, MCoercion) -&gt; Maybe (CoercionR, MCoercion)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkSymCo"><span class="hs-identifier hs-var">mkSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864341"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; MCoercion
</span><a href="GHC.Core.TyCo.Rep.html#MCo"><span class="hs-identifier hs-var">MCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864340"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1442"></span><span>
</span><span id="line-1443"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1444"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (CoercionR, MCoercion)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1445"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1446"></span><span>    </span><span id="local-6989586621680864345"><span class="annot"><span class="annottext">arg :: Type
</span><a href="#local-6989586621680864345"><span class="hs-identifier hs-var hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type
</span><a href="GHC.Core.Type.html#funArgTy"><span class="hs-identifier hs-var">funArgTy</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864337"><span class="hs-identifier hs-var">tyR</span></a></span><span>
</span><span id="line-1447"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864343"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864343"><span class="hs-identifier hs-var">tyL</span></a></span></span><span> </span><span id="local-6989586621680864337"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864337"><span class="hs-identifier hs-var">tyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864346"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1448"></span><span>
</span><span id="line-1449"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoercionIntoLambda"><span class="hs-identifier hs-type">pushCoercionIntoLambda</span></a></span><span>
</span><span id="line-1450"></span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#InScopeSet"><span class="hs-identifier hs-type">InScopeSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1451"></span><span class="hs-comment">-- This implements the Push rule from the paper on coercions</span><span>
</span><span id="line-1452"></span><span class="hs-comment">--    (\x. e) |&gt; co</span><span>
</span><span id="line-1453"></span><span class="hs-comment">-- ===&gt;</span><span>
</span><span id="line-1454"></span><span class="hs-comment">--    (\x'. e |&gt; co')</span><span>
</span><span id="line-1455"></span><span id="pushCoercionIntoLambda"><span class="annot"><span class="annottext">pushCoercionIntoLambda :: InScopeSet -&gt; Var -&gt; Expr Var -&gt; CoercionR -&gt; Maybe (Var, Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#pushCoercionIntoLambda"><span class="hs-identifier hs-var hs-var">pushCoercionIntoLambda</span></a></span></span><span> </span><span id="local-6989586621680864335"><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864335"><span class="hs-identifier hs-var">in_scope</span></a></span></span><span> </span><span id="local-6989586621680864334"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864334"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621680864333"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864333"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864332"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864332"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1456"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isTyVar</span><span> </span><span class="hs-identifier">x</span><span class="hs-special">)</span><span> </span><span class="hs-operator">&amp;&amp;</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">isCoVar</span><span> </span><span class="hs-identifier">x</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">True</span><span>
</span><span id="line-1457"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864331"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864331"><span class="hs-identifier hs-var">s1s2</span></a></span></span><span> </span><span id="local-6989586621680864330"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864330"><span class="hs-identifier hs-var">t1t2</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864332"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1458"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864329"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864329"><span class="hs-identifier hs-var">_s1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864328"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864328"><span class="hs-identifier hs-var">_s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type, Type)
</span><a href="GHC.Core.Type.html#splitFunTy_maybe"><span class="hs-identifier hs-var">splitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864331"><span class="hs-identifier hs-var">s1s2</span></a></span><span>
</span><span id="line-1459"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864326"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864326"><span class="hs-identifier hs-var">w1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864325"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864325"><span class="hs-identifier hs-var">t1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680864324"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864324"><span class="hs-identifier hs-var">_t2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (Type, Type, Type)
</span><a href="GHC.Core.Type.html#splitFunTy_maybe"><span class="hs-identifier hs-var">splitFunTy_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864330"><span class="hs-identifier hs-var">t1t2</span></a></span><span>
</span><span id="line-1460"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864323"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864323"><span class="hs-identifier hs-var">co_mult</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864322"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864322"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864321"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864321"><span class="hs-identifier hs-var">co2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
</span><a href="GHC.Core.Coercion.html#decomposeFunCo"><span class="hs-identifier hs-var">decomposeFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864332"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1461"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflexiveCo"><span class="hs-identifier hs-var">isReflexiveCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864323"><span class="hs-identifier hs-var">co_mult</span></a></span><span>
</span><span id="line-1462"></span><span>      </span><span class="hs-comment">-- We can't push the coercion in the case where co_mult isn't</span><span>
</span><span id="line-1463"></span><span>      </span><span class="hs-comment">-- reflexivity. See pushCoValArg for more details.</span><span>
</span><span id="line-1464"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-1465"></span><span>          </span><span class="hs-comment">-- Should we optimize the coercions here?</span><span>
</span><span id="line-1466"></span><span>          </span><span class="hs-comment">-- Otherwise they might not match too well</span><span>
</span><span id="line-1467"></span><span>          </span><span id="local-6989586621680864320"><span class="annot"><span class="annottext">x' :: Var
</span><a href="#local-6989586621680864320"><span class="hs-identifier hs-var hs-var">x'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864334"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Type -&gt; Var
</span><a href="GHC.Types.Id.html#setIdType"><span class="hs-operator hs-var">`setIdType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864325"><span class="hs-identifier hs-var">t1</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; Type -&gt; Var
</span><a href="GHC.Types.Var.html#setIdMult"><span class="hs-operator hs-var">`setIdMult`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864326"><span class="hs-identifier hs-var">w1</span></a></span><span>
</span><span id="line-1468"></span><span>          </span><span id="local-6989586621680864317"><span class="annot"><span class="annottext">in_scope' :: InScopeSet
</span><a href="#local-6989586621680864317"><span class="hs-identifier hs-var hs-var">in_scope'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864335"><span class="hs-identifier hs-var">in_scope</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet -&gt; Var -&gt; InScopeSet
</span><a href="GHC.Types.Var.Env.html#extendInScopeSet"><span class="hs-operator hs-var">`extendInScopeSet`</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864320"><span class="hs-identifier hs-var">x'</span></a></span><span>
</span><span id="line-1469"></span><span>          </span><span id="local-6989586621680864316"><span class="annot"><span class="annottext">subst :: Subst
</span><a href="#local-6989586621680864316"><span class="hs-identifier hs-var hs-var">subst</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Subst -&gt; Var -&gt; Expr Var -&gt; Subst
</span><a href="GHC.Core.Subst.html#extendIdSubst"><span class="hs-identifier hs-var">extendIdSubst</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">InScopeSet -&gt; Subst
</span><a href="GHC.Core.Subst.html#mkEmptySubst"><span class="hs-identifier hs-var">mkEmptySubst</span></a></span><span> </span><span class="annot"><span class="annottext">InScopeSet
</span><a href="#local-6989586621680864317"><span class="hs-identifier hs-var">in_scope'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1470"></span><span>                                </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864334"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-1471"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-identifier hs-var">mkCast</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var
forall b. Var -&gt; Expr b
</span><a href="GHC.Core.html#Var"><span class="hs-identifier hs-var">Var</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864320"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864322"><span class="hs-identifier hs-var">co1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1472"></span><span>      </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864320"><span class="hs-identifier hs-var">x'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Subst -&gt; Expr Var -&gt; Expr Var
Subst -&gt; Expr Var -&gt; Expr Var
</span><a href="GHC.Core.Subst.html#substExpr"><span class="hs-identifier hs-var">substExpr</span></a></span><span> </span><span class="annot"><span class="annottext">Subst
</span><a href="#local-6989586621680864316"><span class="hs-identifier hs-var">subst</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864333"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-operator hs-var">`mkCast`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864321"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1473"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1474"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Maybe (Var, Expr Var) -&gt; Maybe (Var, Expr Var)
forall a. String -&gt; SDoc -&gt; a -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprTrace"><span class="hs-identifier hs-var">pprTrace</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;exprIsLambda_maybe: Unexpected lambda in case&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Expr Var -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; Expr Var
forall b. b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-var">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864334"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864333"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1475"></span><span>      </span><span class="annot"><span class="annottext">Maybe (Var, Expr Var)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1476"></span><span>
</span><span id="line-1477"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-type">pushCoDataCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Coercion"><span class="hs-identifier hs-type">Coercion</span></a></span><span>
</span><span id="line-1478"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.DataCon.html#DataCon"><span class="hs-identifier hs-type">DataCon</span></a></span><span>
</span><span id="line-1479"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- Universal type args</span><span>
</span><span id="line-1480"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- All other args incl existentials</span><span>
</span><span id="line-1481"></span><span class="hs-comment">-- Implement the KPush reduction rule as described in &quot;Down with kinds&quot;</span><span>
</span><span id="line-1482"></span><span class="hs-comment">-- The transformation applies iff we have</span><span>
</span><span id="line-1483"></span><span class="hs-comment">--      (C e1 ... en) `cast` co</span><span>
</span><span id="line-1484"></span><span class="hs-comment">-- where co :: (T t1 .. tn) ~ to_ty</span><span>
</span><span id="line-1485"></span><span class="hs-comment">-- The left-hand one must be a T, because exprIsConApp returned True</span><span>
</span><span id="line-1486"></span><span class="hs-comment">-- but the right-hand one might not be.  (Though it usually will.)</span><span>
</span><span id="line-1487"></span><span id="pushCoDataCon"><span class="annot"><span class="annottext">pushCoDataCon :: DataCon
-&gt; [Expr Var] -&gt; CoercionR -&gt; Maybe (DataCon, [Type], [Expr Var])
</span><a href="GHC.Core.SimpleOpt.html#pushCoDataCon"><span class="hs-identifier hs-var hs-var">pushCoDataCon</span></a></span></span><span> </span><span id="local-6989586621680864314"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span></span><span> </span><span id="local-6989586621680864313"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864313"><span class="hs-identifier hs-var">dc_args</span></a></span></span><span> </span><span id="local-6989586621680864312"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864312"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1488"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864312"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864311"><span class="hs-identifier hs-var">from_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864309"><span class="hs-identifier hs-var">to_ty</span></a></span><span>  </span><span class="hs-comment">-- try cheap test first</span><span>
</span><span id="line-1489"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864308"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864308"><span class="hs-identifier hs-var">univ_ty_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864307"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864307"><span class="hs-identifier hs-var">rest_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; ([Expr Var], [Expr Var])
forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon -&gt; [Var]
</span><a href="GHC.Core.DataCon.html#dataConUnivTyVars"><span class="hs-identifier hs-var">dataConUnivTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864313"><span class="hs-identifier hs-var">dc_args</span></a></span><span>
</span><span id="line-1490"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(DataCon, [Type], [Expr Var])
-&gt; Maybe (DataCon, [Type], [Expr Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Expr Var -&gt; Type) -&gt; [Expr Var] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Type
</span><a href="GHC.Core.html#exprToType"><span class="hs-identifier hs-var">exprToType</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864308"><span class="hs-identifier hs-var">univ_ty_args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864307"><span class="hs-identifier hs-var">rest_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1491"></span><span>
</span><span id="line-1492"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864303"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864302"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864302"><span class="hs-identifier hs-var">to_tc_arg_tys</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Type -&gt; Maybe (TyCon, [Type])
Type -&gt; Maybe (TyCon, [Type])
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864309"><span class="hs-identifier hs-var">to_ty</span></a></span><span>
</span><span id="line-1493"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; TyCon
</span><a href="GHC.Core.DataCon.html#dataConTyCon"><span class="hs-identifier hs-var">dataConTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span>
</span><span id="line-1494"></span><span>        </span><span class="hs-comment">-- These two tests can fail; we might see</span><span>
</span><span id="line-1495"></span><span>        </span><span class="hs-comment">--      (C x y) `cast` (g :: T a ~ S [a]),</span><span>
</span><span id="line-1496"></span><span>        </span><span class="hs-comment">-- where S is a type function.  In fact, exprIsConApp</span><span>
</span><span id="line-1497"></span><span>        </span><span class="hs-comment">-- will probably not be called in such circumstances,</span><span>
</span><span id="line-1498"></span><span>        </span><span class="hs-comment">-- but there's nothing wrong with it</span><span>
</span><span id="line-1499"></span><span>
</span><span id="line-1500"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-1501"></span><span>        </span><span id="local-6989586621680864299"><span class="annot"><span class="annottext">tc_arity :: BranchCount
</span><a href="#local-6989586621680864299"><span class="hs-identifier hs-var hs-var">tc_arity</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; BranchCount
</span><a href="GHC.Core.TyCon.html#tyConArity"><span class="hs-identifier hs-var hs-var">tyConArity</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span><span>
</span><span id="line-1502"></span><span>        </span><span id="local-6989586621680864298"><span class="annot"><span class="annottext">dc_univ_tyvars :: [Var]
</span><a href="#local-6989586621680864298"><span class="hs-identifier hs-var hs-var">dc_univ_tyvars</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Var]
</span><a href="GHC.Core.DataCon.html#dataConUnivTyVars"><span class="hs-identifier hs-var">dataConUnivTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span>
</span><span id="line-1503"></span><span>        </span><span id="local-6989586621680864297"><span class="annot"><span class="annottext">dc_ex_tcvars :: [Var]
</span><a href="#local-6989586621680864297"><span class="hs-identifier hs-var hs-var">dc_ex_tcvars</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Var]
</span><a href="GHC.Core.DataCon.html#dataConExTyCoVars"><span class="hs-identifier hs-var">dataConExTyCoVars</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span>
</span><span id="line-1504"></span><span>        </span><span id="local-6989586621680864295"><span class="annot"><span class="annottext">arg_tys :: [Scaled Type]
</span><a href="#local-6989586621680864295"><span class="hs-identifier hs-var hs-var">arg_tys</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DataCon -&gt; [Scaled Type]
</span><a href="GHC.Core.DataCon.html#dataConRepArgTys"><span class="hs-identifier hs-var">dataConRepArgTys</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span>
</span><span id="line-1505"></span><span>
</span><span id="line-1506"></span><span>        </span><span id="local-6989586621680864293"><span class="annot"><span class="annottext">non_univ_args :: [Expr Var]
</span><a href="#local-6989586621680864293"><span class="hs-identifier hs-var hs-var">non_univ_args</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; [Expr Var]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#dropList"><span class="hs-identifier hs-var">dropList</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864298"><span class="hs-identifier hs-var">dc_univ_tyvars</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864313"><span class="hs-identifier hs-var">dc_args</span></a></span><span>
</span><span id="line-1507"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864291"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864291"><span class="hs-identifier hs-var">ex_args</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864290"><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864290"><span class="hs-identifier hs-var">val_args</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; ([Expr Var], [Expr Var])
forall b a. [b] -&gt; [a] -&gt; ([a], [a])
</span><a href="GHC.Utils.Misc.html#splitAtList"><span class="hs-identifier hs-var">splitAtList</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864297"><span class="hs-identifier hs-var">dc_ex_tcvars</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864293"><span class="hs-identifier hs-var">non_univ_args</span></a></span><span>
</span><span id="line-1508"></span><span>
</span><span id="line-1509"></span><span>        </span><span class="hs-comment">-- Make the &quot;Psi&quot; from the paper</span><span>
</span><span id="line-1510"></span><span>        </span><span id="local-6989586621680864289"><span class="annot"><span class="annottext">omegas :: [CoercionR]
</span><a href="#local-6989586621680864289"><span class="hs-identifier hs-var hs-var">omegas</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BranchCount -&gt; CoercionR -&gt; [Role] -&gt; [CoercionR]
</span><a href="GHC.Core.Coercion.html#decomposeCo"><span class="hs-identifier hs-var">decomposeCo</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><a href="#local-6989586621680864299"><span class="hs-identifier hs-var">tc_arity</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864312"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; [Role]
</span><a href="GHC.Core.Coercion.html#tyConRolesRepresentational"><span class="hs-identifier hs-var">tyConRolesRepresentational</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1511"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621680864286"><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="#local-6989586621680864286"><span class="hs-identifier hs-var">psi_subst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864285"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864285"><span class="hs-identifier hs-var">to_ex_arg_tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1512"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Role
-&gt; [Var]
-&gt; [CoercionR]
-&gt; [Var]
-&gt; [Type]
-&gt; (Type -&gt; CoercionR, [Type])
</span><a href="GHC.Core.Coercion.html#liftCoSubstWithEx"><span class="hs-identifier hs-var">liftCoSubstWithEx</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span>
</span><span id="line-1513"></span><span>                              </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864298"><span class="hs-identifier hs-var">dc_univ_tyvars</span></a></span><span>
</span><span id="line-1514"></span><span>                              </span><span class="annot"><span class="annottext">[CoercionR]
</span><a href="#local-6989586621680864289"><span class="hs-identifier hs-var">omegas</span></a></span><span>
</span><span id="line-1515"></span><span>                              </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864297"><span class="hs-identifier hs-var">dc_ex_tcvars</span></a></span><span>
</span><span id="line-1516"></span><span>                              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Expr Var -&gt; Type) -&gt; [Expr Var] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Type
</span><a href="GHC.Core.html#exprToType"><span class="hs-identifier hs-var">exprToType</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864291"><span class="hs-identifier hs-var">ex_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1517"></span><span>
</span><span id="line-1518"></span><span>          </span><span class="hs-comment">-- Cast the value arguments (which include dictionaries)</span><span>
</span><span id="line-1519"></span><span>        </span><span id="local-6989586621680864283"><span class="annot"><span class="annottext">new_val_args :: [Expr Var]
</span><a href="#local-6989586621680864283"><span class="hs-identifier hs-var hs-var">new_val_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Expr Var -&gt; Expr Var)
-&gt; [Type] -&gt; [Expr Var] -&gt; [Expr Var]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864281"><span class="hs-identifier hs-var">cast_arg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680864295"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864290"><span class="hs-identifier hs-var">val_args</span></a></span><span>
</span><span id="line-1520"></span><span>        </span><span id="local-6989586621680864281"><span class="annot"><span class="annottext">cast_arg :: Type -&gt; Expr Var -&gt; Expr Var
</span><a href="#local-6989586621680864281"><span class="hs-identifier hs-var hs-var">cast_arg</span></a></span></span><span> </span><span id="local-6989586621680864279"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864279"><span class="hs-identifier hs-var">arg_ty</span></a></span></span><span> </span><span id="local-6989586621680864278"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864278"><span class="hs-identifier hs-var">arg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-identifier hs-var">mkCast</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864278"><span class="hs-identifier hs-var">arg</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="#local-6989586621680864286"><span class="hs-identifier hs-var">psi_subst</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864279"><span class="hs-identifier hs-var">arg_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1521"></span><span>
</span><span id="line-1522"></span><span>        </span><span id="local-6989586621680864277"><span class="annot"><span class="annottext">to_ex_args :: [Expr b]
</span><a href="#local-6989586621680864277"><span class="hs-identifier hs-var hs-var">to_ex_args</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Expr b) -&gt; [Type] -&gt; [Expr b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Expr b
forall b. Type -&gt; Expr b
</span><a href="GHC.Core.html#Type"><span class="hs-identifier hs-var">Type</span></a></span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864285"><span class="hs-identifier hs-var">to_ex_arg_tys</span></a></span><span>
</span><span id="line-1523"></span><span>
</span><span id="line-1524"></span><span>        </span><span id="local-6989586621680864255"><span class="annot"><span class="annottext">dump_doc :: SDoc
</span><a href="#local-6989586621680864255"><span class="hs-identifier hs-var hs-var">dump_doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">DataCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">,</span><span>      </span><span class="annot"><span class="annottext">[Var] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864298"><span class="hs-identifier hs-var">dc_univ_tyvars</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864297"><span class="hs-identifier hs-var">dc_ex_tcvars</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1525"></span><span>                         </span><span class="annot"><span class="annottext">[Scaled Type] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680864295"><span class="hs-identifier hs-var">arg_tys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Expr Var] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864313"><span class="hs-identifier hs-var">dc_args</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1526"></span><span>                         </span><span class="annot"><span class="annottext">[Expr Var] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864291"><span class="hs-identifier hs-var">ex_args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Expr Var] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864290"><span class="hs-identifier hs-var">val_args</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864312"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864311"><span class="hs-identifier hs-var">from_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864309"><span class="hs-identifier hs-var">to_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span><span>
</span><span id="line-1527"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Type -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; SDoc) -&gt; Type -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; [Type] -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConApp"><span class="hs-identifier hs-var">mkTyConApp</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680864303"><span class="hs-identifier hs-var">to_tc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Expr Var -&gt; Type) -&gt; [Expr Var] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; Type
</span><a href="GHC.Core.html#exprToType"><span class="hs-identifier hs-var">exprToType</span></a></span><span> </span><span class="annot"><span class="annottext">([Expr Var] -&gt; [Type]) -&gt; [Expr Var] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; [Expr Var] -&gt; [Expr Var]
forall b a. [b] -&gt; [a] -&gt; [a]
</span><a href="GHC.Utils.Misc.html#takeList"><span class="hs-identifier hs-var">takeList</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864298"><span class="hs-identifier hs-var">dc_univ_tyvars</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864313"><span class="hs-identifier hs-var">dc_args</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1528"></span><span>    </span><span class="hs-keyword">in</span><span>
</span><span id="line-1529"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">eqType</span><span> </span><span class="hs-identifier">from_ty</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">mkTyConApp</span><span> </span><span class="hs-identifier">to_tc</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">map</span><span> </span><span class="hs-identifier">exprToType</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">takeList</span><span> </span><span class="hs-identifier">dc_univ_tyvars</span><span> </span><span class="hs-identifier">dc_args</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dump_doc</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1530"></span><span>    </span><span class="hs-identifier">ASSERT2</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">equalLength</span><span> </span><span class="hs-identifier">val_args</span><span> </span><span class="hs-identifier">arg_tys</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dump_doc</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1531"></span><span>    </span><span class="annot"><span class="annottext">(DataCon, [Type], [Expr Var])
-&gt; Maybe (DataCon, [Type], [Expr Var])
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680864314"><span class="hs-identifier hs-var">dc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680864302"><span class="hs-identifier hs-var">to_tc_arg_tys</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[Expr Var]
forall {b}. [Expr b]
</span><a href="#local-6989586621680864277"><span class="hs-identifier hs-var">to_ex_args</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var] -&gt; [Expr Var] -&gt; [Expr Var]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Expr Var]
</span><a href="#local-6989586621680864283"><span class="hs-identifier hs-var">new_val_args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1532"></span><span>
</span><span id="line-1533"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1534"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (DataCon, [Type], [Expr Var])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1535"></span><span>
</span><span id="line-1536"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1537"></span><span>    </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864311"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864311"><span class="hs-identifier hs-var">from_ty</span></a></span></span><span> </span><span id="local-6989586621680864309"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864309"><span class="hs-identifier hs-var">to_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864312"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1538"></span><span>
</span><span id="line-1539"></span><span class="annot"><a href="GHC.Core.SimpleOpt.html#collectBindersPushingCo"><span class="hs-identifier hs-type">collectBindersPushingCo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1540"></span><span class="hs-comment">-- Collect lambda binders, pushing coercions inside if possible</span><span>
</span><span id="line-1541"></span><span class="hs-comment">-- E.g.   (\x.e) |&gt; g         g :: &lt;Int&gt; -&gt; blah</span><span>
</span><span id="line-1542"></span><span class="hs-comment">--        = (\x. e |&gt; Nth 1 g)</span><span>
</span><span id="line-1543"></span><span class="hs-comment">--</span><span>
</span><span id="line-1544"></span><span class="hs-comment">-- That is,</span><span>
</span><span id="line-1545"></span><span class="hs-comment">--</span><span>
</span><span id="line-1546"></span><span class="hs-comment">-- collectBindersPushingCo ((\x.e) |&gt; g) === ([x], e |&gt; Nth 1 g)</span><span>
</span><span id="line-1547"></span><span id="collectBindersPushingCo"><span class="annot"><span class="annottext">collectBindersPushingCo :: Expr Var -&gt; ([Var], Expr Var)
</span><a href="GHC.Core.SimpleOpt.html#collectBindersPushingCo"><span class="hs-identifier hs-var hs-var">collectBindersPushingCo</span></a></span></span><span> </span><span id="local-6989586621680864252"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864252"><span class="hs-identifier hs-var">e</span></a></span></span><span>
</span><span id="line-1548"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864251"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864252"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1549"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1550"></span><span>    </span><span class="hs-comment">-- Peel off lambdas until we hit a cast.</span><span>
</span><span id="line-1551"></span><span>    </span><span class="annot"><a href="#local-6989586621680864251"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1552"></span><span>    </span><span class="hs-comment">-- The accumulator is in reverse order</span><span>
</span><span id="line-1553"></span><span>    </span><span id="local-6989586621680864251"><span class="annot"><span class="annottext">go :: [Var] -&gt; Expr Var -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864251"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span id="local-6989586621680864250"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864250"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864249"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864249"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864248"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864248"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864251"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864249"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">Var -&gt; [Var] -&gt; [Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864250"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864248"><span class="hs-identifier hs-var">e</span></a></span><span>
</span><span id="line-1554"></span><span>    </span><span class="annot"><a href="#local-6989586621680864251"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864247"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864247"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864246"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864246"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864245"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864245"><span class="hs-identifier hs-var">co</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864247"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864246"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864245"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1555"></span><span>    </span><span class="annot"><a href="#local-6989586621680864251"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680864243"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864243"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621680864242"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864242"><span class="hs-identifier hs-var">e</span></a></span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Var] -&gt; [Var]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864243"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864242"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1556"></span><span>
</span><span id="line-1557"></span><span>    </span><span class="hs-comment">-- We are in a cast; peel off casts until we hit a lambda.</span><span>
</span><span id="line-1558"></span><span>    </span><span class="annot"><a href="#local-6989586621680864244"><span class="hs-identifier hs-type">go_c</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1559"></span><span>    </span><span class="hs-comment">-- (go_c bs e c) is same as (go bs e (e |&gt; c))</span><span>
</span><span id="line-1560"></span><span>    </span><span id="local-6989586621680864244"><span class="annot"><span class="annottext">go_c :: [Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var hs-var">go_c</span></a></span></span><span> </span><span id="local-6989586621680864241"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864241"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Cast"><span class="hs-identifier hs-type">Cast</span></a></span><span> </span><span id="local-6989586621680864240"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864240"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864239"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864239"><span class="hs-identifier hs-var">co1</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680864238"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864238"><span class="hs-identifier hs-var">co2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864241"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864240"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864239"><span class="hs-identifier hs-var">co1</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkTransCo"><span class="hs-operator hs-var">`mkTransCo`</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864238"><span class="hs-identifier hs-var">co2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1561"></span><span>    </span><span class="annot"><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span id="local-6989586621680864237"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864237"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-type">Lam</span></a></span><span> </span><span id="local-6989586621680864236"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864236"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864235"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864235"><span class="hs-identifier hs-var">e</span></a></span></span><span class="hs-special">)</span><span>    </span><span id="local-6989586621680864234"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864234"><span class="hs-identifier hs-var">co</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Var -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864233"><span class="hs-identifier hs-var">go_lam</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864237"><span class="hs-identifier hs-var">bs</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864236"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864235"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864234"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1562"></span><span>    </span><span class="annot"><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span id="local-6989586621680864232"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864232"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621680864231"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864231"><span class="hs-identifier hs-var">e</span></a></span></span><span>            </span><span id="local-6989586621680864230"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864230"><span class="hs-identifier hs-var">co</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Var] -&gt; [Var]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864232"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-identifier hs-var">mkCast</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864231"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864230"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1563"></span><span>
</span><span id="line-1564"></span><span>    </span><span class="hs-comment">-- We are in a lambda under a cast; peel off lambdas and build a</span><span>
</span><span id="line-1565"></span><span>    </span><span class="hs-comment">-- new coercion for the body.</span><span>
</span><span id="line-1566"></span><span>    </span><span class="annot"><a href="#local-6989586621680864233"><span class="hs-identifier hs-type">go_lam</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#CoercionR"><span class="hs-identifier hs-type">CoercionR</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.html#CoreExpr"><span class="hs-identifier hs-type">CoreExpr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1567"></span><span>    </span><span class="hs-comment">-- (go_lam bs b e c) is same as (go_c bs (\b.e) c)</span><span>
</span><span id="line-1568"></span><span>    </span><span id="local-6989586621680864233"><span class="annot"><span class="annottext">go_lam :: [Var] -&gt; Var -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864233"><span class="hs-identifier hs-var hs-var">go_lam</span></a></span></span><span> </span><span id="local-6989586621680864229"><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864229"><span class="hs-identifier hs-var">bs</span></a></span></span><span> </span><span id="local-6989586621680864228"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span id="local-6989586621680864227"><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864227"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span id="local-6989586621680864226"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span></span><span>
</span><span id="line-1569"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isTyVar"><span class="hs-identifier hs-var">isTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1570"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864225"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864225"><span class="hs-identifier hs-var">tyL</span></a></span></span><span> </span><span id="local-6989586621680864224"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864224"><span class="hs-identifier hs-var">tyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1571"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isForAllTy_ty</span><span> </span><span class="hs-identifier">tyL</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1572"></span><span>        </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy_ty"><span class="hs-identifier hs-var">isForAllTy_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864224"><span class="hs-identifier hs-var">tyR</span></a></span><span>
</span><span id="line-1573"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- See Note [collectBindersPushingCo]</span><span>
</span><span id="line-1574"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">Var -&gt; [Var] -&gt; [Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864229"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864227"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkNomReflCo"><span class="hs-identifier hs-var">mkNomReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyVarTy"><span class="hs-identifier hs-var">mkTyVarTy</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1575"></span><span>
</span><span id="line-1576"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isCoVar"><span class="hs-identifier hs-var">isCoVar</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1577"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864221"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864221"><span class="hs-identifier hs-var">tyL</span></a></span></span><span> </span><span id="local-6989586621680864220"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864220"><span class="hs-identifier hs-var">tyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1578"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isForAllTy_co</span><span> </span><span class="hs-identifier">tyL</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1579"></span><span>        </span><span class="annot"><span class="annottext">Type -&gt; Bool
</span><a href="GHC.Core.Type.html#isForAllTy_co"><span class="hs-identifier hs-var">isForAllTy_co</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864220"><span class="hs-identifier hs-var">tyR</span></a></span><span>
</span><span id="line-1580"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
Role -&gt; BranchCount -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkNthCo"><span class="hs-identifier hs-var">mkNthCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">BranchCount
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- See Note [collectBindersPushingCo]</span><span>
</span><span id="line-1581"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680864218"><span class="annot"><span class="annottext">cov :: CoercionR
</span><a href="#local-6989586621680864218"><span class="hs-identifier hs-var hs-var">cov</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Var -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkCoVarCo"><span class="hs-identifier hs-var">mkCoVarCo</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1582"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">Var -&gt; [Var] -&gt; [Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864229"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864227"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; CoercionR -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkInstCo"><span class="hs-identifier hs-var">mkInstCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Type -&gt; CoercionR
</span><a href="GHC.Core.Coercion.html#mkNomReflCo"><span class="hs-identifier hs-var">mkNomReflCo</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CoercionR -&gt; Type
</span><a href="GHC.Core.Type.html#mkCoercionTy"><span class="hs-identifier hs-var">mkCoercionTy</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864218"><span class="hs-identifier hs-var">cov</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1583"></span><span>
</span><span id="line-1584"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Var -&gt; Bool
</span><a href="GHC.Types.Var.html#isId"><span class="hs-identifier hs-var">isId</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1585"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="annot"><a href="GHC.Data.Pair.html#Pair"><span class="hs-identifier hs-type">Pair</span></a></span><span> </span><span id="local-6989586621680864215"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864215"><span class="hs-identifier hs-var">tyL</span></a></span></span><span> </span><span id="local-6989586621680864214"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680864214"><span class="hs-identifier hs-var">tyR</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Pair Type
</span><a href="GHC.Core.Coercion.html#coercionKind"><span class="hs-identifier hs-var">coercionKind</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1586"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ASSERT</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">isFunTy</span><span> </span><span class="hs-identifier">tyL</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">isFunTy</span><span> </span><span class="hs-identifier">tyR</span><span>
</span><span id="line-1587"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680864213"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864213"><span class="hs-identifier hs-var">co_mult</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864212"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864212"><span class="hs-identifier hs-var">co_arg</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680864211"><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864211"><span class="hs-identifier hs-var">co_res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt;
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
Role -&gt; CoercionR -&gt; (CoercionR, CoercionR, CoercionR)
</span><a href="GHC.Core.Coercion.html#decomposeFunCo"><span class="hs-identifier hs-var">decomposeFunCo</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Representational"><span class="hs-identifier hs-var">Representational</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span>
</span><span id="line-1588"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864213"><span class="hs-identifier hs-var">co_mult</span></a></span><span> </span><span class="hs-comment">-- See Note [collectBindersPushingCo]</span><span>
</span><span id="line-1589"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CoercionR -&gt; Bool
</span><a href="GHC.Core.Coercion.html#isReflCo"><span class="hs-identifier hs-var">isReflCo</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864212"><span class="hs-identifier hs-var">co_arg</span></a></span><span>  </span><span class="hs-comment">-- See Note [collectBindersPushingCo]</span><span>
</span><span id="line-1590"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Var] -&gt; Expr Var -&gt; CoercionR -&gt; ([Var], Expr Var)
</span><a href="#local-6989586621680864244"><span class="hs-identifier hs-var">go_c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span class="annot"><span class="annottext">Var -&gt; [Var] -&gt; [Var]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864229"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864227"><span class="hs-identifier hs-var">e</span></a></span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864211"><span class="hs-identifier hs-var">co_res</span></a></span><span>
</span><span id="line-1591"></span><span>
</span><span id="line-1592"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Var] -&gt; [Var]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[Var]
</span><a href="#local-6989586621680864229"><span class="hs-identifier hs-var">bs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Expr Var -&gt; CoercionR -&gt; Expr Var
</span><a href="GHC.Core.Utils.html#mkCast"><span class="hs-identifier hs-var">mkCast</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Var -&gt; Expr Var -&gt; Expr Var
forall b. b -&gt; Expr b -&gt; Expr b
</span><a href="GHC.Core.html#Lam"><span class="hs-identifier hs-var">Lam</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680864228"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="annot"><span class="annottext">Expr Var
</span><a href="#local-6989586621680864227"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CoercionR
</span><a href="#local-6989586621680864226"><span class="hs-identifier hs-var">co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1593"></span><span>
</span><span id="line-1594"></span><span class="hs-comment">{-

Note [collectBindersPushingCo]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We just look for coercions of form
   &lt;type&gt; # w -&gt; blah
(and similarly for foralls) to keep this function simple.  We could do
more elaborate stuff, but it'd involve substitution etc.

-}</span><span>
</span><span id="line-1604"></span></pre></body></html>